[英]How to import an .rcproject file into a Xcode project?
If I load an AR Game template it creates a file called Experience which is a Reality Composer file that you can reference in code.如果我加载一个 AR 游戏模板,它会创建一个名为 Experience 的文件,这是一个您可以在代码中引用的 Reality Composer 文件。 So you can see here:
所以你可以在这里看到:
let boxAnchor = try! Experience.loadBox()
Which is good... but how do I do this in my project?哪个好...但是我如何在我的项目中执行此操作? I created a Reality Composer file and added it to the project, but I cannot reference it?
我创建了一个 Reality Composer 文件并将其添加到项目中,但我无法引用它?
And I cannot seem to find the additional link I need to add here to make it work?而且我似乎找不到我需要在此处添加以使其正常工作的附加链接? Do I have to call the file "Experience.rcproject", surely not?
我一定要把文件称为“Experience.rcproject”吗?
To load another Reality Composer scene (enumeration), you have to take four steps:要加载另一个 Reality Composer 场景(枚举),您必须执行四个步骤:
rook16.rcproject
to Rook16.rcproject
in Xcode Navigator pane.rook16.rcproject
重命名为Rook16.rcproject
。Rook16.loadBox()
.Rook16.loadBox()
。Rook16
in Navigator, go to Inspector (file tab) and tick a Target Membership.Rook16
,转到 Inspector(文件选项卡)并勾选 Target Membership。 Here's the SwiftUI code:这是 SwiftUI 代码:
func makeUIView(context: Context) -> ARView {
let arView = ARView(frame: .zero)
let rook16 = try! Rook16.loadBox()
arView.scene.anchors.append(rook16)
return arView
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.