class in UnityEngine
/
Inherits from:Unity.Scripting.LifecycleManagement.LifecycleAttributeBase
Marks a static method as a callback to be invoked when exiting Play mode.
Methods marked with this attribute are called when exiting Play mode. This happens:
Use this callback to:
This is a method attribute that can only be applied to static methods with no parameters and return type void.
Important: Due to differences in the way different platforms handle closing or navigating away from a running application, [OnExitingPlayMode] is subject to the same platform-specific limitations in built Players as MonoBehaviour.OnApplicationQuit. For more information, refer to the description for MonoBehaviour.OnApplicationQuit.
Additional resources: OnEnteringPlayModeAttribute, BeforeManagedObjectsBackupAttribute.
using UnityEngine;
public static partial class PlayModeManager { [OnExitingPlayMode] static void OnPlayModeExited() { Debug.Log("Exiting Play mode"); } }
| Constructor | Description |
|---|---|
| OnExitingPlayModeAttribute | Marks the decorated static method to be invoked when exiting Play mode. |