I tried to display a Scene loaded from a .rcproject file in ARView with .nonAR mode.
But could not display it on my iPhone 8 which is actual device. I have confirmed that the simulator display the scene properly. If the camera mode is set to .ar, the scene is displayed in actual device.
I am puzzled as to why scene loaded from .rcproject file does not show up with my actual device. If anyone has had the similar experience or has an idea of the cause, I would appreciate it if you could help me.
Thank you for taking the time to read this post.
struct ARViewContainer: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
// if cameramode is ".ar", work properly
let arview = ARView(frame: .zero, cameraMode: .nonAR)
Sample.loadMySceneAsync { (result) in
do {
let myScene = try result.get()
arview.scene.anchors.append(myScene)
} catch {
print("Failed to load myScene")
}
}
let camera = PerspectiveCamera()
let cameraAnchor = AnchorEntity(world: [0, 0.2, 0.5])
cameraAnchor.addChild(camera)
arView.scene.addAnchor(cameraAnchor)
return arview
}
func updateUIView(_ uiView: ARView, context: Context) {}
}