- Home /
OnEditorQuit?
Hi
Is there any way to detect when the Unity Editor shuts down? I have an EditorWindow that needs to be informed when Unity Quits and OnDestroy is not called.
Hacky workarounds are also welcome ;-)
Many thanks.
Have you tried using OnDisable
ins$$anonymous$$d of OnDestroy
?
Answer by psycocrusher · Mar 30, 2013 at 12:30 AM
Have you tried:
function OnApplicationQuit(){
}
yes i have. It's only part of $$anonymous$$onoBehaviour and not of EditorWindow. Nevertheless, it doesn't get called on a $$anonymous$$onoBehaviour either.
Did you try using ExecuteInEdit$$anonymous$$ode
attribute on an in-editor $$anonymous$$onoBehaviour
?
good point, i did not put ExecuteInEdit$$anonymous$$ode on the $$anonymous$$onoBehaviour, after doing that, OnDestroy was successfully called. It's seems like a bug though, that OnDestroy is not called on an EditorWindow that also has ExecuteInEdit$$anonymous$$ode. I wonder how editor extensions perform a last action, after the user closes unity.