- Home /
How to disable idle timer in Unity game? (mobile screen-saver)
Hi,
I'm wondering if it is possible to disable idle timer in my game. User uses only accelometer as input so if he does not touch device screen for a longer while screen becomes black, is it possible to turn it off from unity code?
best regards and thanks in advance for help!
Answer by RamenxNoodles · Apr 24, 2012 at 02:59 PM
I found this;
//Disable screen dimming
Screen.sleepTimeout = SleepTimeout.NeverSleep;
Answer by $$anonymous$$ · Apr 30, 2012 at 09:23 AM
Screen.sleepTimeout = 0.0f;
That seems to be the most current solution that'll work on both platforms...
Answer by venkspower · Apr 30, 2012 at 09:38 AM
In Unity 3.4, if you mention, Screen.sleepTimeout = 0;
Maybe you should use it in the Start()
. But if you are using Unity 3.5, you should use: Screen.sleepTimeout = (int)SleepTimeout.NeverSleep;
.
I hope this works. Good luck.
Your answer
