Legacy Documentation: Version 2018.2 (Go to current version)
  • C#


Suggest a change




Submission failed





Sent to all game objects before the application quits.

In the editor this is called when the user stops playmode.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void OnApplicationQuit() { Debug.Log("Application ending after " + Time.time + " seconds"); } }


Note: On Windows Store Apps and Windows Phone 8.1 there is no application quit event. Consider using OnApplicationFocus event when focusStatus equals false.
Note: On WebGL it is not possible to implement OnApplicationQuit due to nature of the browser tabs closing.
