I'm using the latest NGUI version. I have a button that needs to change face under certain conditions. When I change a face the following occur:
1. Original button hover color does not take effect
2. Sprite's tint does not take effect. Note that without changing the face name - it works fine
Here is my code:
GameObject sprite_game_object = button_game_object.transform.FindChild("Background").gameObject;
UISprite sprite
= sprite_game_object
.GetComponent(typeof(UISprite
)) as UISprite
;
sprite.color = Color.red; //this works without changing a face below
sprite.spriteName = "name from Atlas"; //this changes the face but the color change above gets ignored; the hover effect on the button dissapears as well
sprite.MakePixelPerfect();
One more thing. I've noticed that if I use a sliced image type on a sprite - after changing a face it get sized correctly. But if i use a simple image type then a new face does not get re-sized. Neither type solves the problem with tint or hover colors presented above.
If anyone has any ideas I would appreciate it greatly.