Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

samsung android device buttons light doesn't turn off

Discussion in 'Android' started by Felipe_Silva, Mar 18, 2015.

  1. Felipe_Silva

    Felipe_Silva

    Joined:
    Jan 16, 2015
    Posts:
    13
    Tested on:

    unity 5 x64 f4 and p1 on Windows 7 (6.1.7600) 64bit
    samsung GT-I9195 with Android OS 4.2.2 / API-17 (JDQ39/I9195UBUBNA2)

    problem: samsung android device buttons light doesn't turn off


    Hi, i have this problem, the 2 buttons (menu and back) from the device keep the lights on and doesn't turn off in the game.

    thx.
     
  2. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    524
    They should turn off by default. Make sure you don't have any scripts that turn off fullscreen mode. Either by calling Screen.fullScreen = false. Or a call to Screen.SetResolution().
     
  3. Felipe_Silva

    Felipe_Silva

    Joined:
    Jan 16, 2015
    Posts:
    13
    thx. i will try it.
     
  4. Felipe_Silva

    Felipe_Silva

    Joined:
    Jan 16, 2015
    Posts:
    13
    I found it.

    this instruction :

    Screen.sleepTimeout = SleepTimeout.NeverSleep;

    not only keeps the lit screen, but also the lights of device buttons...
     
  5. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    524
    :-( Must be a side effect of obtaining a wake-lock. Do you mind filing a bug report? I'd like to create a workaround if possible.
     
  6. TMK

    TMK

    Joined:
    Mar 29, 2010
    Posts:
    83
    I also submitted a bug report regarding this issue in August 2014, but it was dismissed as expected behaviour, so I had to fix it myself. The case number for that bug report is:

    Case 627232

    I fixed it by not using NeverSleep (which uses WAKE_LOCK) but instead created an Android plugin that calls the following:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
     
  7. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    524
    That was my thinking too, thanks!
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    6,695
    Is this fixed on *any* version? I stumbled upon it on 4.6.9p2.
     
  9. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    524
    Yes, in Unity 5
     
unityunity