Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: abhaya.agrawal on April 10, 2015, 01:26:13 PM
-
When i am changing it on mouse click its changing and instantly going back to previous sprite.
this is the code i am using.
public void Local()
{
localButtons.GetComponent<UISprite>().spriteName = "local_inner_shadow";
cloudButtons.GetComponent<UISprite>().spriteName = "cloud";
}
i also tried like this
public void Local()
{
UISprite sprite1 = localButtons.GetComponent<UISprite>();
sprite1.spriteName = "local_inner_shadow";
UISprite sprite2 = cloudButtons.GetComponent<UISprite>();
sprite2.spriteName = "cloud";
}
but same problem is there.
-
UIButton component will change the sprite. Do you have a button attached?
-
Yes button is attached.
-
So remove it. :P
As I said, button changes the sprite for you. If you want only color to change, use UIButtonColor instead.