Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Laursen on August 27, 2014, 02:08:35 AM

Title: [SOLVED] Stop UIButton from changing sprite
Post by: Laursen on August 27, 2014, 02:08:35 AM
EDIT: I solved it by modifying the UIButton script to include a condition "spriteSwitch" to evaluate before trying to change the sprite of the object.

Hello everyone!

This is my first post, but here goes.

After updating NGUI from 3.6.x to 3.7.1, I have noticed that the component UIButton contains functionality to change the sprite of the object to represent the states "Normal", "Hover", "Pressed" and "Disabled". (See attachment)

My problem is that I manually update my buttons when I click them, and want them to stay that way. (Think button for sound on/off that needs to retain the changed sprite) Because of this new functionality, I assume, my sprite keeps changes to the starting sprite from "Normal" state, whenever my mouse exists the object, causing whatever change of sprite I have made, to be overridden.

Is there any way to disable sprite switching on UIButtons?

Kind regards,
Laursen
Title: Re: [SOLVED] Stop UIButton from changing sprite
Post by: ArenMook on August 27, 2014, 04:26:59 AM
Consider simply switching to UIButtonColor instead of UIButton.
Title: Re: [SOLVED] Stop UIButton from changing sprite
Post by: Laursen on August 27, 2014, 07:40:10 AM
I would have done this, if my GUI wasn't allready set up to use the On Notify from the button component :)

But I will definitely consider it next time, thanks!