Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: SuperTalesNat on May 13, 2013, 04:10:54 AM
Title:
Help on UIWidget / UISprite coloring of the ColorTint?
Post by:
SuperTalesNat
on
May 13, 2013, 04:10:54 AM
So i've been trying to get this to work to no avail.
There's multiple objects in the hierarchy that all need to be changed, hence the for loop.
Any help would be GREATLY appreciated.
Color RecColor
=
new
Color
(
0
,
255
,
0
,
255
)
;
UISprite
[
]
recColor
=
RecBorder
.
GetComponentInChildren
<
UISprite
>
(
)
.
color
;
foreach
(
UISprite u
in
recColor
)
{
recColor
=
RecColor
;
}
Title:
Re: Help on UIWidget / UISprite coloring of the ColorTint?
Post by:
dlewis
on
May 13, 2013, 04:56:53 AM
You're never actually accessing the sprite (and there for the color component) in the for loop
Title:
Re: Help on UIWidget / UISprite coloring of the ColorTint?
Post by:
SuperTalesNat
on
May 13, 2013, 10:47:21 AM
Duhr, that'll teach me to try and code, and then ask a dumb question at 2am.
Got a good nights sleep (kind of) and saw the issue this morning as well.
Color RecColor
=
new
Color
(
0
,
255
,
0
,
255
)
;
UISprite
[
]
recColor
=
RecBorder
.
GetComponentsInChildren
<
UISprite
>
(
)
;
foreach
(
UISprite u
in
recColor
)
{
u
.
color
=
RecColor
;
}
Title:
Re: Help on UIWidget / UISprite coloring of the ColorTint?
Post by:
ArenMook
on
May 13, 2013, 10:55:54 AM
255 is invalid when creating a Color. Color values range from 0 to 1. You're creating a Color, passing Color32's parameters there.