# CancelQuit()

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

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

> **Warning:**
>
> **Deprecated.** CancelQuit is deprecated. Use the wantsToQuit event instead.

```csharp
public static void CancelQuit()
```

### Remarks

This function only works in the Player.

**Note:** [Application.CancelQuit](/engine/6000.7/script-reference/unityengine/application/cancelquit.md) is deprecated. Use [Application.wantsToQuit](/engine/6000.7/script-reference/unityengine/application/wantstoquit.md) instead.

**Note:** This function has no effect on iPhone. Application cannot prevent termination under iPhone OS.

### Examples

```csharp
using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour
{
    // Delays quitting for 2 seconds and
    // loads the finalsplash level during that time.

    float showSplashTimeout = 2.0f;
    bool  allowQuitting = false;

    void Awake()
    {
        // This game object needs to survive multiple levels
        Application.DontDestroyOnLoad(this.gameObject);
    }

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

        // Don't allow the user to exit until we got permission in
        if (!allowQuitting)
        {
            Application.CancelQuit();
        }
    }

    IEnumerator DelayedQuit()
    {
        Application.LoadLevel("finalsplash");

        // Wait for showSplashTimeout
        yield return new WaitForSeconds(showSplashTimeout);

        // then quit for real
        allowQuitting = true;
        Application.Quit();
    }
}
```
