正在从 iOS 本地目录加载 .rcproject

Loading .rcproject from iOS local directory

我正在尝试从本地目录加载 rcproject。我的目标是从 URL 加载它然后显示它。

如果我这样加载它:

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:///'.

我不知道这里的问题是什么。有人有想法吗,我可以尝试什么?

我的开发目标是14.4

在苹果 docs 中,他们写道,它应该像这样工作,对吧?

loadAnchor(contentsOf:withName:)类型方法是为.usd.usda.usdc.usdz.reality文件格式组成的。然而官方文档说现在它们只适用于 现实文件 。你可以阅读它 here.

public static func loadAnchor(contentsOf url: URL, 
                       withName resourceName: String?) throws -> AnchorEntity

你的代码中有一个定义:

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 same resourceName.