Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: ENAY on May 17, 2012, 11:47:28 PM
-
Ok, stupid question alert. How do I change a sprite into another? In code all I want to do is choose another sprite in the atlas.
Put simply, I want something like this.
MyNGUIMenu.GetComponentsInChildren<UISprite>()[0].image = "image2";
This is for a character select screen, I have my window, multiple faces in the atlas, just need to find that last piece of the puzzle to change the face.
-
You will want to change the sprite name.
UISprite mySprite.spriteName = "newSprite";
-
I tried spritename earlier and nothing happened. So I tried it again and now it magically works. >:(
I am sometimes baffled by Unity sometimes. :-[
Thanks for that dlewis, feels really embarrassing asking such a stupid question but hey, I have no shame. :)
-
Thanks for that dlewis, feels really embarrassing asking such a stupid question but hey, I have no shame. :)
Stupid questions are my speciality! :P