Documentation

Unity Engine

Download Unity

Unity Engine

enterPlayModeOptions

Determines the state of the Enter Play Mode Options in the Unity Editor.
Read time 1 minuteLast updated 13 days ago

Definition

  • Type: Property
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
public static EnterPlayModeOptions enterPlayModeOptions { get; set; }

Remarks

To learn more about the flags for the Enter Play Mode Options, refer to EnterPlayModeOptions.

Examples

using UnityEngine;using UnityEditor;// Adds a menu item to toggle a faster Play mode that disables // both code and scene reloads in the Editor.static class FastEnterPlayModeExample{ // Adds a menu item to the Editor. [MenuItem("Tools/Toggle Fast Play mode")] public static void ToggleFastPlayMode() { const EnterPlayModeOptions noReload = EnterPlayModeOptions.DisableDomainReload | EnterPlayModeOptions.DisableSceneReload; // Check if both DisableDomainReload and DisableSceneReload are set. bool fastPlayMode = (EditorSettings.enterPlayModeOptions & noReload) == noReload; if (!fastPlayMode) { // Set both DisableDomainReload and DisableSceneReload flags. EditorSettings.enterPlayModeOptions = noReload; // Print status to the Console. Debug.Log("Enabled Fast Play mode. Disabled both code and scene reloads."); } else { // Turn code and scene reload back on (Reload Domain and Scene). EditorSettings.enterPlayModeOptions = EnterPlayModeOptions.None; // Print status to the Console Debug.Log("Disabled Fast Play mode. Enabled code and scene reloads."); } }}