Skip to main content
July 8, 2021
Solved

Screen on/off detector ??

  • July 8, 2021
  • 2 replies
  • 933 views

is it possible to detect when screen on/off [or when pressed power button] on unity?? [Quest 2]

    This topic has been closed for replies.
    Best answer by korinVR

    Probably this page might help.
    https://developer.oculus.com/documentation/unity/unity-lifecycle/

    2 replies

    korinVR
    korinVRAnswer
    Honored Contributor
    July 8, 2021
    Katsuomi Kobayashi ( @korinVR ) at FrameSynthesis Inc.
    Honored Contributor
    July 8, 2021

    The application lifecycle is indeed what you need but be careful as OnApplicationQuit() isn't always called. See this: https://forum.unity.com/threads/onapplicationquit-and-ondestroy-is-not-executed-when-exit-app-on-oculus-quest.795942/

     

    For your requirements, OnApplicationPause() should do the trick