MonoBehaviour.OnApplicationQuit is called before Application.wantsToQuit
which leads to undesired behavior. Application.wantsToQuit can be used to
interrupt a quit process, so you can show the user a window ("do you really want to quit?").
If you cancel the quit, but MonoBehaviour.OnApplicationQuit executes anyways, stuff breaks.
I am aware this changes current behavior and is dealing with inconsistencies in the Unity API
MonoBehaviour.OnApplicationQuit
is called beforeApplication.wantsToQuit
which leads to undesired behavior.Application.wantsToQuit
can be used to interrupt a quit process, so you can show the user a window ("do you really want to quit?"). If you cancel the quit, butMonoBehaviour.OnApplicationQuit
executes anyways, stuff breaks. I am aware this changes current behavior and is dealing with inconsistencies in the Unity API