Author Topic: SlicedSprite in UIbutton not updating  (Read 4881 times)

sachaM

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
SlicedSprite in UIbutton not updating
« 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


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SlicedSprite in UIbutton not updating
« Reply #1 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.

sachaM

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: SlicedSprite in UIbutton not updating
« Reply #2 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;


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SlicedSprite in UIbutton not updating
« Reply #3 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?

sachaM

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: SlicedSprite in UIbutton not updating
« Reply #4 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.

« Last Edit: December 09, 2012, 02:48:24 PM by sachaM »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SlicedSprite in UIbutton not updating
« Reply #5 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