Application.CancelQuit Manual     Reference     Scripting  
Scripting > Runtime Classes > Application

static function CancelQuit () : void


Cancels quitting the application. This is useful for showing a splash screen at the end of a game.

This function only works in the player and does nothing in the web player or editor.

// Delays quitting for 2 seconds and
// loads the finalsplash level during that time.
var showSplashTimeout = 2.0;
private var allowQuitting = false;

function Awake () {
// This game object needs to survive multiple levels
DontDestroyOnLoad (this);

function OnApplicationQuit () {
// If we haven't already load up the final splash screen level
if (Application.loadedLevelName.ToLower() != "finalsplash")

// Don't allow the user to exit until we got permission in
if (!allowQuitting)

function DelayedQuit ()

// Wait for showSplashTimeout
yield WaitForSeconds(showSplashTimeout);

// then quit for real
allowQuitting = true;