Search Unity

Question Reset ar foundation

Discussion in 'AR' started by izeko2004, Jul 11, 2021.

  1. izeko2004

    izeko2004

    Joined:
    Dec 28, 2014
    Posts:
    74
    Is it possible to reset the ar session. If I load a none ar scene from the ar scene and go back to the ar scene. My objects are persisted. Arsession.reset() does not work and causes the app to crash.

    Can anyone advise?
     
  2. eugeneloza

    eugeneloza

    Joined:
    Dec 3, 2019
    Posts:
    24
    Hmmmm... ARSession.Reset works for me and does exactly what we want it - clears all current tracked managers and forces them to reinitialize again. The objects persist in the scene and are updated accordingly after the scene reset (however, here additional attention should be paid to make the update consistent). Note that you have to call it on ARSession instance, e.g. gameObject.GetComponent<ARSession>().Reset();
     
  3. izeko2004

    izeko2004

    Joined:
    Dec 28, 2014
    Posts:
    74
    Ah ok. I will give this a go. I had made a property in code and then dragged the arSession onto it.
     
  4. aravinda1879

    aravinda1879

    Joined:
    Feb 2, 2020
    Posts:
    3
    Any updates on this? I dragged the arSession to the reset button and did exactly what was on samples. But the app crashes the moment I press reset. Any possible way to clean the screen without restarting the app?
     
  5. izeko2004

    izeko2004

    Joined:
    Dec 28, 2014
    Posts:
    74
    Try what eugeneloza says above:


    you have to call it on ARSession instance, e.g. gameObject.GetComponent<ARSession>().Reset(); what eugeneloza says above:
    eugeneloza