Sent to all GameObjects before the application quits.
In the Editor, Unity calls OnApplicationQuit when exiting Play mode. It's called on all script components, even if the component is disabled.
Platform-specific considerations:
OnApplicationQuit won't be called. Use MonoBehaviour.OnApplicationPause instead for handling app suspension and cleanup.OnApplicationQuit because of the way browser tabs close. For a workaround, refer to Interaction with browser scripting in the manual.using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void OnApplicationQuit() { Debug.Log("Application ending after " + Time.time + " seconds"); } }