设置UGUI Color 的 RGB值
程序员文章站
2024-03-18 12:52:10
...
Case1 : 直接指定顏色名
Color gray = new color32(80, 80, 80, 255); //RGB (0-255)
Color gray2 = new color(0.313f, 0.313f, 0.313f, 1); //RGB (0-1.0)
// gray = gray2
void ChangeColor()
{
text1.color = gray;
image1.color = gray2;
}
Case2 : 指定为方法
void ChangeColor(Text text, byte r, byte g, byte b, byte a)
{
if ( text != null)
{
text.color = new color(r, g, b, a);
}
}
上一篇: flutter中的color