IMPORTANT:

All Oculus Quest developers MUST PASS the concept review prior to gaining publishing access to the Quest Store and additional resources. Submit a concept document for review as early in your Quest application development cycle as possible: https://developer.oculus.com/quest-pitch/

For additional information and context, please see "Submitting Your App to the Oculus Quest Store".
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Unity OnApplicationQuit() call when closing app

Hi,

I need to send a message to a server when my oculus Quest app is closed.
In OnApplicationQuit(), I'm calling my function to send a message to the server but it appeared that the server never received the message.
Are all Unity's methods are called when closing an app on Oculus Quest ? 
Is there a better way to send call a function when clicking on the close app button from Oculus menu ?

Regards

Comments

  • Kev1970Kev1970 Posts: 24 Oculus Start Member
    I dont think onaplicationquit ever gets called.

    Onapplicationpaused is called but not in all cases (like the user just taking the headset off, although perhaps after 10 seconds it may be, by which time they may have turned the device off).

    You can check in update to see if the user is still wearing the headset and if theyre not then take action in case they end up quitting. Do the same for the pause state and you should be covered for all scenarios of users quitting your application.

    Just honouring onapplicationquit would have been much easier and more intuitive of course.
  • rh_galaxyrh_galaxy Posts: 121 Oculus Start Member
    edited January 11
    I don't see the OnApplicationQuit call... I myself does

    if (Menu.bQuit) //indication in my own code that we should quit
    {
    #if UNITY_EDITOR
        //Application.Quit() does not work in the editor so
        // this need to be set to false to end the game
        UnityEditor.EditorApplication.isPlaying = false;
    #else
        UnityEngine.Application.Quit();
    #endif
    }
Sign In or Register to comment.