Is it possible to run code before the Unity player is closed (by closed, we mean all ways of closing the program, either by Alt+F4, pressing the X button on the window corners, closed from within the game, etc.)? If yes, how?
Asked
Active
Viewed 3,323 times
1
-
If it were WinForms, you'd want to subscribe to the `FormClosing` or `FormClosed` event. Not sure if Unity3D supports that, though... – Nolonar Aug 14 '13 at 07:29
-
2Is it [OnApplicationQuit](http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnApplicationQuit.html) ? – Matthew Watson Aug 14 '13 at 07:42
-
Awesome. That seems so trivial I feel so dumb. Could you post that as an answer so I can accept it, please? – brain56 Aug 14 '13 at 08:05