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. Dismiss Notice

Resolved Left / Right / Both Eyes view in Unity Game View

Discussion in 'XR Interaction Toolkit and Input' started by Federica_96, Feb 19, 2021.

  1. Federica_96

    Federica_96

    Joined:
    Feb 19, 2021
    Posts:
    30
    Hi,

    I'm having a problem with the Game View in Unity (2019.4.11 version).

    When clicking play I would like to see both eyes views but I can't change nothing from the left eye.

    I've read you can change this configuration with

    Code (CSharp):
    1. UnityEngine.XR.XRSettings.gameViewRenderMode = UnityEngine.XR.GameViewRenderMode.BothEyes

    But I can't find in the scripts this line of code. Where can I find it?

    Thank you.
     

    Attached Files:

  2. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    220
    XRSettings.gameViewRenderMode is the property that you would set if you want to change that dropdown through scripting API. With
    using UnityEngine.XR;
    you can set
    XRSettings.gameViewRenderMode = GameViewRenderMode.BothEyes;
    in a method of your MonoBehaviour and it should work if you have the HMD device connected.
     
  3. Federica_96

    Federica_96

    Joined:
    Feb 19, 2021
    Posts:
    30
    Thank you!
     
  4. TeddySoldier

    TeddySoldier

    Joined:
    Aug 14, 2018
    Posts:
    1
    The problem I having is that I want to go back to normal rendering mode again... Without seeing Left, Right or Both Eyes and I cant do it.
     
  5. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    220
    If you mean that you want to deinitialize XR and go back to a regular PC standalone application, you can do so by calling DeinitializeLoader. See the XR Plugin Management documentation for information about manually loading and unloading XR.

    Example to shut down XR:
    Code (CSharp):
    1. using UnityEngine.XR.Management;
    2. ...
    3. if (XRGeneralSettings.Instance.Manager.isInitializationComplete)
    4. {
    5.     XRGeneralSettings.Instance.Manager.DeinitializeLoader();
    6. }
    Example to restart XR:
    Code (CSharp):
    1. if (!XRGeneralSettings.Instance.Manager.isInitializationComplete)
    2. {
    3.    XRGeneralSettings.Instance.Manager.InitializeLoaderSync();
    4.    if (XRGeneralSettings.Instance.Manager.isInitializationComplete)
    5.    {
    6.         XRGeneralSettings.Instance.Manager.StartSubsystems();
    7.    }
    8. }