从iOS本地目录加载.rcproject [英] Loading .rcproject from iOS local directory
问题描述
我正在尝试从本地目录加载 rcproject
.我的目标是从URL加载然后显示它.
I am trying to load a rcproject
from a local directory. My target is, to load it from an URL and then show it.
如果我这样加载它:
let modelScene = try? Entity.loadAnchor(named: "Experience")
一切正常.
但是,如果我这样做:
let url = URL(fileURLWithPath: "./Experience")
或
let url = URL(fileURLWithPath: "./Experience.rcproject")
和
let modelScene = try? Entity.loadAnchor(contentsOf: url, withName: "Experience")
或
let modelScene = try? Entity.loadAnchor(contentsOf: url)
我收到以下错误:
// [Pipeline] Failed to open scene 'Experience -- file:///'.
我不知道这里的问题是什么.有人知道我可以尝试什么吗?
I have no idea, what the issue here is. Did someone has an idea, what i can try?
我的发展目标是14.4
My development target is 14.4
在苹果 docs 中,他们写道,应该这样工作吧?
In the apple docs, they write, that it should work like this, right?
推荐答案
loadAnchor(contentsOf:withName:)
类型方法由 .usd
,组成.usda
, .usdc
, .usdz
和 .reality
文件格式.但是官方文档说,现在它们仅适用于 Reality文件.您可以在此处阅读.
loadAnchor(contentsOf:withName:)
type method was composed for .usd
, .usda
, .usdc
, .usdz
and .reality
file formats. However official documentation says that now they work only for Reality files. You can read about it here.
public static func loadAnchor(contentsOf url: URL,
withName resourceName: String?) throws -> AnchorEntity
这是代码中的定义:
支持的文件格式为USD或Reality.为了在整个网络会话中标识资源,该资源需要具有唯一的名称.此名称是使用
resourceName
设置的.网络会话中的所有参与者都需要加载资源并分配相同的resourceName
.
Supported file formats are USD or Reality. In order to identify a resource across a network session, the resource needs to have a unique name. This name is set using
resourceName
. All participants in the network session need to load the resource and assign the sameresourceName
.
这篇关于从iOS本地目录加载.rcproject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!