Reset ARSession after get out from AR Scene

Include the following details (edit as applicable):

  • Device type & OS version: Android / iOS / Other Ex. iPhone 8+ on iOS 13
  • Host machine & OS version: Mac
  • Issue Environment : On Device
  • Xcode version:
  • ARDK version:
  • Unity version:

Description of the issue:

When I get into a AR scene, do something on it, some mesh object rendered on scene, some game objects which spawned on scene, some plane objects rendered when plane was detected. All is work perfectly

But when I get out from this scene, then get in again. What the messing they are! Sometimes, all off game objects run with wrong position in the scene, so disgusting what I saw.

I think the main issue is belong to ARSession, it need to be reset to clear all this mess. But in ARDK package, i saw it using IARSession which is not the ARSession of original Unity XR package.

So how to reset this session to achieve what I expected.
Thanks for help

Hi Khang,

If you’re running Lightship 2.5.2 or below, you aren’t supposed to mix and match ARFoundation/UnityXR elements with the ARDK. Assuming you’re running Lightship 2.5 or below, you should utilize the Unity events OnApplicationPause and OnApplicationResume and explicitly call IARSession#Pause() and IARSession#Resume(ARSessionRunOptions.ResetTracking)` respectively. The resume call should reset the objects so you don’t see a mess! For more information, please look at the ARSessionRunOptions page and our IARSession page in our API reference.

Kind Regards,
Maverick L.

1 Like