Search Unity

Setting Stereo Rendering Mode in Unity/Oculus

Discussion in 'AR/VR (XR) Discussion' started by saifshk17, Jul 17, 2020.

  1. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    I am trying to set the Stereo Rendering Mode to Single Pass for Oculus through Script. The value never gets changed, i.e., it stays the same as "Multi-Pass". Is there a way to set up Stereo Rendering Mode through script during runtime? Thing is if I set it manually to Single-Pass and run the application in Editor, it works fine but then when I stop the run, the settings automatically changes to Multi-Pass.

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using UnityEngine.XR;
    6.  
    7. public class SteoreoRendering : MonoBehaviour
    8. {
    9.     XRSettings.StereoRenderingMode stereoRenderingMode;
    10.     // Start is called before the first frame update
    11.     void Start()
    12.     {
    13.        
    14.     }
    15.  
    16.     // Update is called once per frame
    17.     void Update()
    18.     {
    19.         stereoRenderingMode = XRSettings.StereoRenderingMode.SinglePass;
    20.         Debug.Log(stereoRenderingMode);
    21.     }
    22. }
     
    angela_luo likes this.