UIButtonColor、TweenColor两个组件可以控制gameobject变色。其中UIButtonColor一般附加在Button上,它是变色事件的发送端。而TweenColor附加在target上,它是变色事件的具体执行单位。
UIButtonColor的属性很简单:
public GameObject tweenTarget;
public Color hover = new Color(0.6f, 1f, 0.2f, 1f);
public Color pressed = Color.grey;
public float duration = 0.2f;
tweenTarget就是执行变色的gameObject。hover为高亮颜色,pressed为点击颜色,duration为渐变时间。当UIButtonColor发出变色事件后,target若没有TweenColor组件,则会先给它添加一个TweenColor脚本组件。
在具体变色过程中,color的值还会影响light(若target上有light的话&