Created
July 29, 2019 03:13
-
-
Save thebeardphantom/7d77f7c5254a9b328b02b906e5b7c229 to your computer and use it in GitHub Desktop.
Show confirmation dialog before actually quitting the Unity Editor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
[InitializeOnLoad] | |
public static class EditorHelper | |
{ | |
#region Constructors | |
static EditorHelper() | |
{ | |
EditorApplication.wantsToQuit += OnEditorWantsToQuit; | |
} | |
#endregion | |
#region Methods | |
private static bool OnEditorWantsToQuit() | |
{ | |
return EditorUtility.DisplayDialog("Confirm Quit", "Are you sure you want to quit?", "Yes", "No"); | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment