using System; using UnityEngine; [ExecuteInEditMode] public class AnimatedWidget : MonoBehaviour { private void OnEnable() { this.mWidget = base.GetComponent(); this.LateUpdate(); } private void LateUpdate() { if (this.mWidget != null) { this.mWidget.width = Mathf.RoundToInt(this.width); this.mWidget.height = Mathf.RoundToInt(this.height); } } public float width = 1f; public float height = 1f; private UIWidget mWidget; }