Avoid screen lock on Android and VR


I am programming a VR apk with Unity but the following problem arises.

Being a VR application, I do not have any contact with the touch screen of my mobile phone, so after 10 seconds the screen dims and 5 seconds later it crashes.

I would like to know what solution I can give to this without having to deactivate the screen lock from the mobile.

asked by Marchena14 26.07.2017 в 12:53

2 answers


You have to use sleepTimeout :

Screen.sleepTimeout = SleepTimeout.NeverSleep;

To avoid blocking the mobile.

If you have any problems, add this to the manifiest for permissions:

 <uses-permission android:name="android.permission.WAKE_LOCK" />
answered by 26.07.2017 / 12:58

Try to keep the screen always on with this method


Within your activity, call it in some method that requires you to apply this, and once it is finished, you can remove it with this method.


I hope it works for you.

answered by 26.07.2017 в 16:10