0 votes
by (150 points)
reopened by

I am trying to set screen off and sleep delay to never while doing some tasks like downloading because it can provoke some potential errors.

I have tried using the code below but it does not work, the app stops once I try to set it up...

I found these methods in the documentation, I don't know I'm calling them wrong, or if there is an alternative way of doing this...

        Debug.Log("Setting PropertySetScreenOffDelay");
        Unity.XR.PXR.PXR_Plugin.System.UPxr_PropertySetScreenOffDelay(Unity.XR.PXR.ScreenOffDelayTimeEnum.NEVER, OnScreenOff); // 1 min
        Debug.Log("Setting PropertySetSleepDelay");
        Debug.Log("Setting Finished");

1 Answer

+1 vote
by (55.5k points)
selected by
Best answer

Please check the PUI version and see if there is initialization and binding service in the code.
enter image description here

by (150 points)
reshown by

That's right I did not initialize and bind the System Service.

Thank you very much for your time and attention!