Before posting I searched in the forum, but I dind't find an answer to my question, so I'm asking it here =P
A have a button prefab. I instantiate that prefab, and its background has a UISLicedSprite script on it. I use a manager to instantiate that, and to assign the right atlas to use.
So I reach the gameobject ->
Button.transform.GetChild(0).GetComponent<UISlicedSprite>().atlas
Now, after that, I've to assign the right current sprite wich is in the atlas.spritelist. I tried like this:
Button.transform.GetChild(0).GetComponent<UISlicedSprite>().sprite = myaltas.spritelist[i] //(this is in a for loop)
But all the button instantiated have all the same sprite (spritelist[0] i think). How can i change that sprite after instantiation?
UISlicedsprite.sprite can change the sprite, or can only be read?