Welcome,
Guest
. Please
login
or
register
.
April 23, 2026, 07:49:51 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Changing Color tint of UISprite runtime with NGUI
« previous
next »
Print
Pages: [
1
]
Author
Topic: Changing Color tint of UISprite runtime with NGUI (Read 5081 times)
armnotstrong
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 9
Changing Color tint of UISprite runtime with NGUI
«
on:
June 20, 2017, 05:13:10 AM »
Hi,
I have this script to change the border tint color to red to show the error :
private
void
ShowErr
(
string
errMsg
)
{
gameObject
.
GetComponent
<
UIWidget
>
(
)
.
color
=
Color
.
red
;
//gameObject.GetComponent<UISprite>().color = Color.green;
transform
.
GetChild
(
0
)
.
gameObject
.
SetActive
(
true
)
;
transform
.
GetChild
(
0
)
.
GetChild
(
0
)
.
GetComponent
<
UILabel
>
(
)
.
text
=
errMsg
;
}
Have tried to set the tint color both with UIWidget and UISprite, both methods can change the color in the Inspector, but not the color in the play mode scene.
And I could see the color tint has been changed to red in the inspector during run time, but sprite in the scene still the origin color, What has I done wrong?
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Changing Color tint of UISprite runtime with NGUI
«
Reply #1 on:
June 27, 2017, 11:44:38 AM »
Check what shader your atlas is using. It needs to be an NGUI shader (Unlit - Transparent Colored).
Which sprite is it anyway? If the sprite is entirely black, changing its color won't do anything. Black (0, 0, 0) times red (1, 0, 0) is still black.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Changing Color tint of UISprite runtime with NGUI