C#/Problems

Unity Text 오브젝트 색상 Hex 값으로 변경하기

dev_sr 2020. 6. 12. 15:43

HexaDecimal 색상값을 Text 오브젝트에 적용하기(글자색 변경하기)

 

Color color;

ColorUtility.TryParseHtmlString("#FF3737"out color);

this.amountText.color = color;

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
this.amountText.text = this.rewardAmount.ToString();
Color color;
 
if (data.type==0)
{
    ColorUtility.TryParseHtmlString("#FF3737"out color);
    this.amountText.color = color;
}
else if (data.type == 1)
{
    ColorUtility.TryParseHtmlString("#4388D7"out color);
    this.amountText.color = color;
}
else if (data.type == 2)
{
    ColorUtility.TryParseHtmlString("#F1A917"out color);
    this.amountText.color = color;
}