MonoBhaviourProxy.cs 788 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections;
  2. using UnityEngine;
  3. using System;
  4. namespace GFGGame
  5. {
  6. public class MonoBhaviourProxy : MonoBehaviour
  7. {
  8. public Action start;
  9. public Action update;
  10. public Action onDestroy;
  11. public Action onEnable;
  12. public Action onDisable;
  13. private void OnDestroy()
  14. {
  15. onDestroy?.Invoke();
  16. }
  17. // Use this for initialization
  18. void Start()
  19. {
  20. start?.Invoke();
  21. }
  22. // Update is called once per frame
  23. void Update()
  24. {
  25. update?.Invoke();
  26. }
  27. private void OnEnable()
  28. {
  29. onEnable?.Invoke();
  30. }
  31. private void OnDisable()
  32. {
  33. onDisable?.Invoke();
  34. }
  35. }
  36. }