Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Switching cameras with Unity MARS

Discussion in 'Unity MARS' started by Shivek, Jul 8, 2020.

  1. Shivek


    May 1, 2019
    1. What is the (best and working) way to switch between front and back cameras with Unity MARS?
    I have tried to make two scenes: first scene with some image trackers (for World effect) and second which is unmodified face mask template scene. Unfortunately no matter what (if I start with the first scene and use SceneManager to load the second scene or simply start with the second scene) the second scene is not working properly on my phone but in in Device View it works without issues. The second scene on my phone doesn't show face landmarks and uses world camera.

    2. After that I have set up another test. The second scene only uses RawImage and WebcamTexture with the feed from the front WebcamDevice. There is no MARS Session for second scene there. I was able to track images and switch scenes to see myself via front camera, but after I wanted to switch back to the first scene the trackers stopped to work. How can I reset MARS Session after I switch scene with SceneManager.LoadScene?
    The error which is looping in the XCode debug:
    I use iPhone SE and iOS
    MARS 1.0.2 with MARS AR Foundation 1.0.2
    ARKit XR Plugin 2.1.9
    ARKit FaceTracking 1.0.7
    Unity 2019.4 (might it be the issue?)
  2. jmunozarUTech


    Unity Technologies

    Jun 1, 2020
    Hey There!, You need to have a MARSSession per each scene, unless you are loading additive and you have a session already.

    With regards to the error you are seeing; when the guid is 000000-0000... That means that no image marker id was asssinged to your image marker proxy. could have happened when you changed scenes / you have an image marker that is unassigned an image from a marker library. That explains the no tracking after changing scenes.