Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: sachaM on December 09, 2012, 06:27:16 AM

Title: SlicedSprite in UIbutton not updating
Post by: sachaM on December 09, 2012, 06:27:16 AM
Hello
I did a classic button (unbutton) and changed its textures manually (swapping the pressed and normal one) by script to signal an event.
i'm using the xx.spritename="my texture".

The inspector shows the changes correctly but visually nothing happens until the mouse goes hover the button.

i tried a forced panel update , xx.markaschanged but nothing works.

I guess i missed something somewhere...

thanks for your help

Title: Re: SlicedSprite in UIbutton not updating
Post by: ArenMook on December 09, 2012, 11:17:24 AM
Changing the sprite on the button script won't do anything. You need to change the spriteName of the actual background sprite.
Title: Re: SlicedSprite in UIbutton not updating
Post by: sachaM on December 09, 2012, 12:59:07 PM
i did it on both : background (slicedSprite)  and Button itself (UIImageButton) :

_icon.spriteName=_on;
_button.normalSprite=_on;
_button.hoverSprite=_on;
_button.pressedSprite=_on;

Title: Re: SlicedSprite in UIbutton not updating
Post by: ArenMook on December 09, 2012, 01:51:45 PM
Then it should work. What version of NGUI, Unity, and is the panel your sprite belongs to clipped or not?
Title: Re: SlicedSprite in UIbutton not updating
Post by: sachaM on December 09, 2012, 02:43:49 PM
yes, the panel is clipped one  with a dragable panel and the usual parented scrollbar.
The release used is the last one.

I'm trying to do something like a classic tab panel with tabs added on demand.

Title: Re: SlicedSprite in UIbutton not updating
Post by: ArenMook on December 09, 2012, 03:04:23 PM
I saw no issues with swapping of normal sprites belonging to a clipped panel. There is an issue with swapping textures belonging to a clipped panel, however. See this topic: http://www.tasharen.com/forum/index.php?topic=2465.0