在项目中有多个Button,想给每个Button做一个简单的标识表示开启状态,Toggle也可以,不过在需求没确定之前我决定还是简单的变个色。
单纯更改颜色用最简单的。
发现可以用将内部填充取消再更改字的颜色的效果。
ps,NGUI 的Button的Label的默认字体颜色是( 1, 1, 1, 0.737f)
单纯更改颜色用最简单的。
this.GetComponent<UIButton>().defaultColor = Color.red发现可以用将内部填充取消再更改字的颜色的效果。
this.GetComponent<UISprite>().centerType = UISprite.AdvancedType.Invisible this.GetComponentInChildren<UILabel>().color = Color.whiteps,NGUI 的Button的Label的默认字体颜色是( 1, 1, 1, 0.737f)
本文介绍如何在Unity项目中为多个Button添加简单的状态标识,通过更改颜色来表示开启状态,并展示了实现这一功能的具体代码示例。
733

被折叠的 条评论
为什么被折叠?



