Search Unity

Question ARSession.Reset() is not destroying planes

Discussion in 'AR' started by DoAugMenRo, May 6, 2022.

  1. DoAugMenRo

    DoAugMenRo

    Joined:
    Sep 17, 2019
    Posts:
    18
    Hello everyone,

    Normally if one calls the ARSession.Reset(), all trackables are destroyed as written in the documentation. In one of my projects the screen turns black for a couple of frames (as expected) but when it gets back, all planes are still available. What could be influencing this behavior?
    PlanesNotDestroyed.gif

    This problem must be project specific because i have set up a blank project with the same relevant versions and packages where it is working! Some irrelevant packages differ.
    Unity: 2019.4.24f1
    ARF + ARCore: 4.1.9
    URP: 7.5.3
    PackageComparison.JPG

    I have an identical scene in both projects where i call ARSession.Reset() by passing the ARSession to a button. Apart from the button there is only a ARSessionOrigin and an ARSession and the ARPlaneManager on the ARSessionOrigin. No other modifications components or code have been added! Why is it working in one project but not in the other?
    Scenes.JPG

    Here is are some other things i have tried:
    • Identical settings for: Player, XR Plug-in Management, Quality, Physics. Some other settings might differ but i do not know how this should influence the reset() function?
    • As written in this post. But i do not want to reset the whole scene just the ARSession
      Code (CSharp):
      1. var xrManagerSettings = UnityEngine.XR.Management.XRGeneralSettings.Instance.Manager;
      2. [*]xrManagerSettings.DeinitializeLoader();
      3. UnityEngine.SceneManagement.SceneManager.LoadScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex); // reload current scene
      4. xrManagerSettings.InitializeLoaderSync();
    • I tried to remove and re-add the ARSession Component at runtime.
    • I compared the LogCat output of both versions and did not find any suspicious differences (appended).

    I appreciate any kind of help very much! If there is anything else i should share please let me know.
    Best regards
     

    Attached Files:

  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
    Hi @DoAugMenRo

    You correctly link to our documentation that
    ARSession.Reset
    should destroy all trackables. Our bug filing process will allow you to upload your project where this issue is reproducible if you wouldn't mind filing.
    https://unity3d.com/unity/qa/bug-reporting