AnimatedColor.cs 586 B

1234567891011121314151617181920212223
  1. //----------------------------------------------
  2. // NGUI: Next-Gen UI kit
  3. // Copyright © 2011-2014 Tasharen Entertainment
  4. //----------------------------------------------
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. /// <summary>
  8. /// Makes it possible to animate a color of the widget.
  9. /// </summary>
  10. [ExecuteInEditMode]
  11. [RequireComponent(typeof(Image))]
  12. public class AnimatedColor : MonoBehaviour
  13. {
  14. public Color color = Color.white;
  15. Image mImage;
  16. void OnEnable() { mImage = GetComponent<Image>(); LateUpdate(); }
  17. void LateUpdate() { mImage.color = color; }
  18. }