Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: hjbaard on October 31, 2013, 02:24:57 AM
-
Hi,
I'm trying to set the background color of a button in script (c#)
When I'm using:
_background.color = Color.black; //(_background is a UISprite instance)
It works fine.
But when I try this:
_background.color = new Color(93f, 106f, 114f); //(_background is a UISprite instance)
Nothing happens....
Is this a bug or do I do something wrong here?
-
If I´m not mistaken colors are a floating value between 0 - 1 so 93f gets capped to 1.0
-
If I´m not mistaken colors are a floating value between 0 - 1 so 93f gets capped to 1.0
Thanks! That was the problem :)
Tip:
I found out that if you want to use byte codes voor colors you can use Color32. For example:
new Color32(93, 106, 114, 255)