Search Unity

Issues with Screen.sleepTimeout

Discussion in 'Scripting' started by pthurston, Dec 2, 2016.

  1. pthurston

    pthurston

    Joined:
    May 2, 2016
    Posts:
    3
    Hello, I am trying to control screen dimming/going to sleep in our app. Our app presents animated content in a video like player, so we want to device to not go to sleep when viewing content, but to enable sleeping (using the device settings) when in a menu. Currently I have the following code attached to our menu component

    Code (CSharp):
    1.  
    2.         private void OnEnable(){
    3.             Screen.sleepTimeout = SleepTimeout.SystemSetting;
    4.         }
    5.  
    6.         private void OnDisable(){
    7.             Screen.sleepTimeout = SleepTimeout.NeverSleep;
    8.         }
    9.  
    However, when tested on an iPad the app will never sleep, even after the menu is enabled and visible. We are using Unity 5.3.5. Is this a bug or am I using sleepTimeout incorrectly.

    Thanks,
    Paul
     
  2. JC_SummitTech

    JC_SummitTech

    Joined:
    Nov 1, 2016
    Posts:
    78
    I unfortunately don't have an answer, but I suggest you ask in the platform/ios forum for better chances ;)