ARKitSession() doesn't always start

We have a random issue that when ARKitSession.run() is called, monitorSessionEvents() receives .paused and it never transitions to .running If we exit Immersive Space and do ARKitSesssion.run() again it works fine. Unfortunately this is very difficult to manage in the flow of our App.

  • Are you calling ARKitSession.run() after the user has entered the immersive space or before?

  • After on the load of the Immersive View

Add a Comment

Replies

Hello @rcpdesigns,

Can you provide a focused sample project that reproduces the behavior you are observing?

I will see if the Object Placement Sample Project exhibits the same issue.

One question we have is what order should the monitoring tasks be kicked off?

We have a Task that does for await event in arkitSession.events We have another that does for await anchorUpdate in worldTracking.anchorUpdates These are started before ARKitSession.run()

Perhaps these should be started after??

  • You can start monitoring the async sequences of ARKitSession.events and WorldTrackingProvider.anchorUpdates at any time.

Add a Comment

The order of calls should not affect the eventual state changes. But a DataProvider will only go to .running, when your app is immersive. That said you can run your session in either state. Once you are immersive, it should transition to .running.

  • Thank you for the reply. To be sure I'm correct in understanding. We can call ARKitSession.run() when not in Immersive mode and when we go into Immersive mode it should start running?I am starting to wonder if our problem isn't ARKitSession not running but rather Immersive Space failing. We don't see any errors and it says it started but we don't see graphics. My assumption was the graphics were "somewhere" else because we couldn't find the anchor. Maybe that's not the case.

  • Yes the provider should switch to the .running state once the app enters the immersive space.

Add a Comment

More information. I just had ARKit stay in .pause and while await openImmersiveSpace(id: "OurSpace") returned .opened: there were no graphics visible. I took the AVP off, waited 5 second, put it back on, entered my passcode and our App resumed with graphics in place and ARKit in .running As such I believe the problem might not be ARKit failing to start running but rather Immersive Space saying it is open but it isn't. Either is a problem of course but ImmersiveSpace saying it is open but actually isn't is a bigger problem as it is hard to detect. I will create FB but a minimal sample is going to be difficult. I did try updating to 1.2 beta 4 but I still see the issue. I would say once out of 30 times. Feels like a race condition but I have no idea what I might be able to change to alleviate the issue.