This code works perfectly on a simple cube, however when loading a larger (250mb) .rcproject file I get the "Unexpectedly found nil while implicitly unwrapping an Optional value" error.
My code is as follows:
struct ARSandBox: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
var map: ModelEntity!
let arView = ARView(frame: .zero)
let delayTime = DispatchTime.now() + 3.0
let scene = try! TeaTestMap.loadMapScene()
map = scene.theMap!.children[0] as? ModelEntity
(Error is here at map.isEnabled)
map.isEnabled = false
arView.scene.anchors.append(scene)
DispatchQueue.main.asyncAfter(deadline: delayTime) {
map.isEnabled = true
}
Post
Replies
Boosts
Views
Activity
I have a Reality Composer file with several scenes, all of which starts empty and then some models appear one by one every second. The animation works perfectly in Quicklook and Reality Composer, but has a glitch when rendered in ARKit. When the very first scene is launched or when we go to another scene, they don't start empty.. For a tiny split second, we see all the models of that scene being displayed, only to disappear immediately.
I have tried fixing it using Async loading, as well as delaying the DispatchQueue by 0.5 seconds. If anyone has an idea, it would mean the world if you could help. This is the final bug before the launch of our app.