Skip to content

Instantly share code, notes, and snippets.

@SeppahBaws
Last active January 2, 2020 16:59
Show Gist options
  • Save SeppahBaws/6a67ae426a01d5ac76891c33b6edab8e to your computer and use it in GitHub Desktop.
Save SeppahBaws/6a67ae426a01d5ac76891c33b6edab8e to your computer and use it in GitHub Desktop.

Revisions

  1. SeppahBaws revised this gist Jan 2, 2020. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions EditorStateVisualizer.cs
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,4 @@
    // ================================================
    //
    // EditorStateVisualizer By Seppe Dekeyser.
    //
    // ================================================
    // === EditorStateVisualizer By Seppe Dekeyser. ===

    using UnityEngine;
    using UnityEditor;
  2. SeppahBaws created this gist Dec 22, 2018.
    50 changes: 50 additions & 0 deletions EditorStateVisualizer.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    // ================================================
    //
    // EditorStateVisualizer By Seppe Dekeyser.
    //
    // ================================================

    using UnityEngine;
    using UnityEditor;

    enum EditorState
    {
    Ready,
    Compiling,
    Paused,
    Playing,
    Updating
    }

    public class EditorStateVisualizer : EditorWindow
    {
    private EditorState state;

    [MenuItem("Custom Utils/General/Editor State")]
    static void Init()
    {
    EditorWindow window = EditorWindow.GetWindowWithRect(typeof(EditorStateVisualizer), new Rect(0, 0, 200, 30));
    window.Show();
    }

    void OnGUI()
    {
    if (EditorApplication.isCompiling)
    state = EditorState.Compiling;

    else if (EditorApplication.isPaused)
    state = EditorState.Paused;

    else if (EditorApplication.isPlaying)
    state = EditorState.Playing;

    else if (EditorApplication.isUpdating)
    state = EditorState.Updating;

    else
    state = EditorState.Ready;

    EditorGUILayout.LabelField("Editor state:", state.ToString());
    this.Repaint();
    }
    }