using System; using UnityEngine; [ExecuteInEditMode] public class AnimatedAlpha : MonoBehaviour { private void OnEnable() { this.mWidget = base.GetComponent(); this.mPanel = base.GetComponent(); this.LateUpdate(); } private void LateUpdate() { if (this.mWidget != null) { this.mWidget.alpha = this.alpha; } if (this.mPanel != null) { this.mPanel.alpha = this.alpha; } } [Range(0f, 1f)] public float alpha = 1f; private UIWidget mWidget; private UIPanel mPanel; }