Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Aastha on September 18, 2013, 11:38:49 PM
-
Hi,
I am new to unity and using ngui for widgets. I am changing the sprites of uiimage button on click but the problem is that hoversprite, pressedsprite and normal sprite are changing perfectly in editor but when build for device or xcode simulator the sprites are changing on second click even if the print shows correct sprite name on first click. can anyone please help me.
Here is my code:
void setButtonActiveSprite()
{
imageButton.normalSprite = "yellowsprite";
imageButton.hoverSprite = "yellowsprite";
imageButton.pressedSprite = "yellowsprite";
print (" setting active sprite "+ imageButton.normalSprite);
}
-
Changing on second click? Eh?
-
I'm also clueless on what's going on... Maybe you have more scripts you're not showing us or something you're not telling us.
Try doing it on a clean project. That usually helps to figure out how it works to begin with. Take a look at the NGUI's example folder. There's a lot of buttons working with hover sprites just fine there.
-
Well, we saw some issues with broken references when you're using prefabs. We had to revert all buttons, but then it was okay again. Maybe this is a similar problem?