Search Unity

Oculus Go OnExit/OnDestroy/OnDisable/OnApplicationQuit

Discussion in 'AR/VR (XR) Discussion' started by Wattosan, Jun 4, 2019.

  1. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
    Hey,

    Which built-in event should be used when quitting an application in Oculus Go.
    All of them work only in the editor.

    Thanks!
     
    Last edited: Jun 4, 2019
  2. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
  3. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
  4. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
  5. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Go is running on Android so OnApplicationPause
     
  6. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
    OnApplicationPause is indeed invoked when I press the Oculus button on the remote. However, by pressing that button the game is simply paused. But it can be returned to. The user has the option to either resume or exit the game (this is Oculus behaviour not Unity). If the user selects to exit game, the application is closed. And for closing the application, there is no event.

    Any other ideas?
     
  7. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Yes I have a Go too and know the behavior. However the issue is related to how Android or mobile operating systems work in general when suspending and terminating apps. Technically when you enter the Oculus menu your app is being suspended but you are given some time to perform minor actions before the process is fully suspended. For application termination you will not be given any time, thus such event wouldn't really help you and Unity has not implement one.

    What are you trying to do? it might be possible if you use native android code and hook up to activity destroy event but you will be limited what you will be able to do.