AnimatedAlpha.cs 524 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using UnityEngine;
  3. [ExecuteInEditMode]
  4. public class AnimatedAlpha : MonoBehaviour
  5. {
  6. private void OnEnable()
  7. {
  8. this.mWidget = base.GetComponent<UIWidget>();
  9. this.mPanel = base.GetComponent<UIPanel>();
  10. this.LateUpdate();
  11. }
  12. private void LateUpdate()
  13. {
  14. if (this.mWidget != null)
  15. {
  16. this.mWidget.alpha = this.alpha;
  17. }
  18. if (this.mPanel != null)
  19. {
  20. this.mPanel.alpha = this.alpha;
  21. }
  22. }
  23. [Range(0f, 1f)]
  24. public float alpha = 1f;
  25. private UIWidget mWidget;
  26. private UIPanel mPanel;
  27. }