Skip to main content
New Participant
March 8, 2023
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!

This topic has been closed for replies.
DTNAVRAnswer
New Participant
April 11, 2023

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

ChescoRed
Inspiring
March 9, 2023

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.

VR Developer
DTNAVRAuthorAnswer
New Participant
April 11, 2023

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

New Participant
June 25, 2024

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