Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
DTNA_VR's avatar
DTNA_VR
Explorer
2 years ago
Solved

OVRManager.display returning null

Problem: I'm trying to set my Quest 2 headset to 120hz, Calling OVRManager.display returns null

Details:
I imported the Oculus Integration Plugin then wrote the below code, but when I build and deploy to the headset I get a null reference exception because OVRManager.display returns nulls

Additional Info:
Unity 2021.3.12f1, building for the Quest 2, I have Quest support disabled.
Oculus XR Plugin V3.0.2
XR Plugin Management V4.2.1
Oculus Integration V49.0
BNG VR Interaction Framework 1.82

Thanks in advance for any help!

  • Thanks for the comment, I could not figure it out so I ended up using the Unity XR plugin to change the refresh rate

3 Replies

Replies have been turned off for this discussion
  • Hello, I think the problem is that it is not going through all the frequencies that it collects in "freq" try this.

    private float[] _freqs;
    private float _freqsSelect;
    
        private void Start()
        {
            _freqs = OVRManager.display.displayFrequenciesAvailable;
            _freqsSelect = _freqs[0];
    
            CheckFrequencyDevice(_freqs);
        }
    
    // In this function it loops through all the frequencies returned by OVRManager.display.displayFrequenciesAvailable
    private void CheckFrequencyDevice(float[] f)
        {
            for (int i = 0; i < f.Length; i++)
            {
                if (f[i] > _freqsSelect)
                {
                    _controllerProgressBar.LoadTMPProgressBar(2.0F);
                    _freqsSelect = f[i];
                }
            }
           //Here you can choose the frequency you want. In my case, if it has returned one of more than 90, it means that there is a frequency of 120 and I send it to another function for its assignment. (You can make it more elegant than the example case)
            if(_freqsSelect > 90.0F)
            {
                ToAssingFrequencyDevice(120.0F);
            }
            else
            {
                ToAssingFrequencyDevice(70.0F);
            }
        }
    
        private void ToAssingFrequencyDevice(float hz)
        {
            OVRPlugin.systemDisplayFrequency = hz;
        }

    Greetings and I hope it works for you.

  • Thanks for the comment, I could not figure it out so I ended up using the Unity XR plugin to change the refresh rate

    • AmrSol's avatar
      AmrSol
      Explorer

      How? can you share the code with us?
      i can't set the refresh rate to 120 hz on quest 3 (OS ver66 )