MonoManager.cs 521 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. public class MonoManager : MonoSingleton<MonoManager>
  6. {
  7. private event UnityAction updateEvent;
  8. private void Update()
  9. {
  10. if (updateEvent != null)
  11. {
  12. updateEvent();
  13. }
  14. }
  15. public void AddUpdateListen(UnityAction action)
  16. {
  17. updateEvent += action;
  18. }
  19. public void RemoveUpdateListen(UnityAction action)
  20. {
  21. updateEvent -= action;
  22. }
  23. }