cancel
Showing results for 
Search instead for 
Did you mean: 

Application.quitting not getting called

oculus_dev_12
Level 3

For my project, we have an analytics call that we want to perform when the user is trying to close the application. When we test the logic in the editor, it works just fine. However, on device the code does not get called. I have seen from some other posts that quitting/destroying logic for the application/monobehaviours does not work properly.

 

Is there a resolution or other way to trigger application quitting logic for a Unity application on Oculus devices?

2 REPLIES 2

baroquedub
Level 6

This is an ungoing saga. https://forum.unity.com/threads/onapplicationquit-and-ondestroy-is-not-executed-when-exit-app-on-ocu...
The 'easy' not totally reliable way to do this is to hook into OnApplicationPause but as the above explains, this isn't exactly the same as an application suspend event.
I find you also have to use the various Oculus specific events in the application lifecycle:
https://developer.oculus.com/documentation/unity/unity-lifecycle/
to work out whether the app has quit or if some other esoteric thing has happened like the player moving out of their Guardian

 

Thanks for your response. I've actually commented on the Unity forum post you linked. The Unity lifecycle docs for Oculus might give us something useful, but it's disappointing that there isn't a sure way of doing this.