Sent to all active 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. Unity doesn't send this message to inactive GameObjects.
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"); } }