SCUI3D.cs 530 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [ExecuteInEditMode]
  5. public abstract class SCUI3D : MonoBehaviour
  6. {
  7. protected bool isDirty = false;
  8. protected virtual void Awake()
  9. {
  10. MarkUIDirty();
  11. }
  12. protected virtual void Update()
  13. {
  14. if (!isDirty)
  15. {
  16. return;
  17. }
  18. isDirty = false;
  19. RebuildUI();
  20. }
  21. public virtual void MarkUIDirty()
  22. {
  23. isDirty = true;
  24. }
  25. public abstract void RebuildUI();
  26. }