Search Unity

  1. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Help Wanted How to avoid camera position change on MARS loading?

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

  1. hmkn

    hmkn

    Joined:
    Nov 7, 2019
    Posts:
    23
    Hello.
    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

    amydigiov

    Unity Technologies

    Joined:
    May 24, 2016
    Posts:
    11
    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. }
     
unityunity