Hello.
I'm trying to create a weapon-choosing interface, in which a large button shows and icon for the currently selected weapon, and then when clicked, changes to the next weapon in line from a list of available weapons. So I want the button to show one texture and then show another when clicked.
I have succeeded in getting it to receive a new texture setting, but the button does not update, and still renders the old texture.
I did something like this:
void OnButton() {
UISprite button = GameObject.Find("Background").GetComponent<UISprite>();
button.spriteName = "chestActive";
}
The texture changes in the Inspector but not in rendering. Any help would be greatly appreciated.