# unloading

> Unity raises this event when the Player is unloading.

## Definition

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

```csharp
public static event Action unloading
```

### Remarks

Add an event handler to this event if you want to trigger events to [Application.Unload](/engine/6000.6/script-reference/unityengine/application/unload.md) calls. The event is raised after a call to [Application.Unload](/engine/6000.6/script-reference/unityengine/application/unload.md) is made, right before the unloading starts.

**Note:**  The `Application.unloading` event is only supported on iOS, Android, and Universal Windows Platform.

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

// Unload Unity when the user clicks the button. Exit is not applied to the application.

public class ExampleClass : MonoBehaviour
{
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 200, 75), "Unload"))
            Application.Unload();
    }

    static void OnUnload()
    {
        Debug.Log("Unloading the Player");
    }

    [RuntimeInitializeOnLoadMethod]
    static void RunOnStart()
    {
        Application.unloading += OnUnload;
    }
}
```

Additional Resources: [Application.Unload](/engine/6000.6/script-reference/unityengine/application/unload.md).
