EditorQuit.cs 474 B

12345678910111213141516171819202122
  1. using UnityEditor;
  2. namespace ParrelSync
  3. {
  4. [InitializeOnLoad]
  5. public class EditorQuit
  6. {
  7. /// <summary>
  8. /// Is editor being closed
  9. /// </summary>
  10. static public bool IsQuiting { get; private set; }
  11. static void Quit()
  12. {
  13. IsQuiting = true;
  14. }
  15. static EditorQuit()
  16. {
  17. IsQuiting = false;
  18. EditorApplication.quitting += Quit;
  19. }
  20. }
  21. }