Unity3D execute code before the game closes

3.7k Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

You need to use the OnApplicationQuit() method.