Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: aholla on June 24, 2014, 12:44:41 PM

Title: UIToggle - swapping sprites
Post by: aholla on June 24, 2014, 12:44:41 PM
Hi, Im trying to swap sprites when the toggle in on or off.

I have a button with 2 child "icon" sprites. On the button I have 2 UIToggles which I set the sprite to one of each icon. I set one of the toggles starting state to true.

Now to control all of this I have Get both of the toggles and compare their "activeSprite" to my own starting sprite so I know which one is the "on" and which is the "off" sprite.

Is there a simpler way to achieve this?

Thanks
Title: Re: UIToggle - swapping sprites
Post by: ArenMook on June 25, 2014, 05:57:01 AM
Easiest way is to have a background sprite, and have it be covered up by the active sprite. So when the toggle is active, the active sprite will simply cover up the background sprite.