EditorInit.cs 499 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using Base;
  3. using UnityEditor;
  4. using UnityEngine;
  5. namespace MyEditor
  6. {
  7. [InitializeOnLoad]
  8. internal class EditorInit
  9. {
  10. static EditorInit()
  11. {
  12. Game.EntityEventManager.Register("Editor", typeof(EditorInit).Assembly);
  13. EditorApplication.update += Update;
  14. }
  15. private static void Update()
  16. {
  17. if (Application.isPlaying)
  18. {
  19. return;
  20. }
  21. try
  22. {
  23. Game.EntityEventManager.Update();
  24. }
  25. catch (Exception e)
  26. {
  27. Log.Error(e.ToString());
  28. }
  29. }
  30. }
  31. }