cancel
Showing results for 
Search instead for 
Did you mean: 

OVRManager.display returning null

DTNA_VR
Explorer

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

upload_2023-3-8_14-7-56.png

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

upload_2023-3-8_14-13-45.png

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!

1 ACCEPTED SOLUTION

Accepted Solutions

DTNA_VR
Explorer

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

View solution in original post

2 REPLIES 2

ChescoRed
Explorer

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.

DTNA_VR
Explorer

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