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.

Question How to avoid camera position change on MARS loading?

Discussion in 'Unity MARS' started by hmkn, Dec 24, 2020.

  1. hmkn


    Nov 7, 2019
    I found that when I enter play mode, MARS will override main camera position.
    Since I use camera as a field of view of the player, I would like to avoid force override the camera position.
    Is there a better way to fix it?
  2. amydigiov


    Unity Technologies

    May 24, 2016
    Hi @hmkn , the MARS Session takes control of whichever camera is tagged as "MainCamera". There are two approaches I can think to take here:
    1. Have two cameras in your scene - one which is your custom camera and another tagged as "MainCamera". If there is already a MARS Session in your scene, make sure your custom camera is not the one underneath the MARS Session's hierarchy. If there isn't a Session, add one via "Game Object -> MARS -> MARS Session". Your custom camera will render on top of the Session's camera if it has a higher "Depth" value.
    2. Alternatively, you could have a custom script that sets the MARSCamera's DisablePoseDriving property to true:
    Code (CSharp):
    1. public class CustomCamera : MonoBehaviour
    2. {
    3.     void Start()
    4.     {
    5.         MARSSession.Instance.GetComponentInChildren<MARSCamera>().DisablePoseDriving = true;
    6.     }
    7. }