# ExitingPlayMode

> Occurs when exiting play mode, before the Editor is in edit mode.

## Definition

* **Type:** Field
* **Namespace:** [UnityEditor](/engine/6000.6/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
ExitingPlayMode = 3
```

### Remarks

In this condition, [EditorApplication.isPlaying](/engine/6000.6/script-reference/unityeditor/editorapplication/isplaying.md) is `true` and [EditorApplication.isPlayingOrWillChangePlaymode](/engine/6000.6/script-reference/unityeditor/editorapplication/isplayingorwillchangeplaymode.md) is `false`.

For new code, use [OnExitingPlayModeAttribute](/engine/6000.6/script-reference/unityengine/onexitingplaymodeattribute.md) instead to avoid unnecessary event subscription handling. For more information, refer to [Code reload and the code lifecycle](/engine/6000.6/manual/scripting/compilation-and-code-reload/programming-code-lifecycle.md) in the manual.
