NGUI中用动画编辑器改颜色

由于NGUI的机制,颜色没有做到实时更新。所以在Animation Editor上用曲线编辑没有效果。

到官网上查了下:

using UnityEngine;
 using System.Collections;
 
 [RequireComponent(typeof(UIWidget))]
 public class ColorChanger : MonoBehaviour
 
 {
 
     public Color color = Color.white;
 
  
 
     UIWidget mWidget;
 
  
 
     void Start () { mWidget = GetComponent<UIWidget>(); }
 
     void Update () { mWidget.color = color; }
 
 }
 

挂上这脚本后就可以看到效果。。不过也只能在Play的时候看到。。在动画编辑时还是看不到。。

原文地址:https://www.cnblogs.com/gameprogram/p/2663999.html