Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

OnExitingEditModeAttribute

class in UnityEditor.Scripting.LifecycleManagement

/

Inherits from:Unity.Scripting.LifecycleManagement.LifecycleAttributeBase

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Marks a static method as a callback to be invoked when the Editor exits Edit mode.

Methods marked with this attribute are called when exiting Edit mode. This happens:

  • Before entering Play mode in the Editor.
  • Before code reload in Edit mode.

Use this callback to:

  • Save Edit mode state.
  • Clean up Editor-specific resources.
  • Prepare for Play mode or code reload.

This is a method attribute that can only be applied to static methods with no parameters and return type void.

Additional resources: OnEnteringEditModeAttribute, OnExitingPlayModeAttribute, BeforeManagedObjectsBackupAttribute

using UnityEditor.Scripting.LifecycleManagement;
using UnityEngine;

public static partial class EditorModeManager { [OnExitingEditMode] static void OnEditModeExited() { Debug.Log("Exiting Edit mode"); } }

Constructors

Constructor Description
OnExitingEditModeAttributeMarks the decorated static method to be invoked when exiting Edit mode.

Inherited Members