How do I stop the screen turning off on an android. I can stop the screen going dim but not to stop turning it off. My game uses the accelerometer.
Feb 04 '11 at 11:41 AM
Sep 10 '11 at 01:14 PM
this script does both
iPhoneSettings.screenCanDarken = false;
Feb 04 '11 at 01:37 PM
You should use:
Screen.sleepTimeout = SleepTimeout.NeverSleep;
May 02 '12 at 07:36 PM
May 02 '12 at 05:15 PM
I don't have enough user points/karma/whatever to upvote, yet, but this is the real right answer. .NeverSleep didn't used to exist, but it does now, and you should use it.
The iPhoneSettings.screenCanDarken is deprecated - it's now
Screen.sleepTimeout = 0f;
0 is never darken, other values in seconds - docs here
Jan 27 '12 at 12:30 PM
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
The best place to ask and answer questions about development with Unity. Check out our FAQ for more information.
To help users post good questions and use the site effectively we have posted a tutorial video. Please check it out.
asked: Feb 04 '11 at 11:41 AM
Seen: 3506 times
Last Updated: Feb 20 at 03:29 PM
Font Size vs Screen Resolution
How to get the Screen Size
How do I set an Android applications resolution?
What is the update for iPhoneSettings.screenCanDarken
Android Testing Screen Error
About unity's API for android?
black screen after the first play on android
Screen moves on clicking the button
Android Button Screen
Is there a way to determine Android physical screen size?