Author Topic: UIButton.isEnabled changes not updating background sprite  (Read 2482 times)

pattywac

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
UIButton.isEnabled changes not updating background sprite
« on: February 20, 2014, 07:25:42 PM »
Hi everyone,

I'm using 3.4.8 and I have a panel that is set active through another menu.  In this panel I have multiple children that are panels each with 2 buttons and a couple other sprites/text areas.

When the main panel is activated, a script on it sets all of the UIButton.isEnabled values to false.  I have checked by outputting these values and they are being set properly.  However, the button images stay set as the 'Normal' image instead of the 'Disabled' image.  These are also set correctly on the buttons.

I know the functions work because when I close that panel and open it up again, the buttons have updated to the correct 'Disabled' image, I also output all of the relevant variables and they are correct.  The same panel is later updated through the script so that the buttons should show the 'Normal' image.  I can see through another set of debug messages that the correct functions are being called and the isEnabled variables are being correctly set, but they do not update their images.

I have tried using the following panel functions to see if the child buttons will update...
Refresh()
SetDirty()
RebuildAllDrawCalls()

None of them help.  Any ideas?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButton.isEnabled changes not updating background sprite
« Reply #1 on: February 21, 2014, 04:53:19 PM »
Please update to the latest version of NGUI first. If this is the issue I think it is, it was fixed a while back.

pattywac

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UIButton.isEnabled changes not updating background sprite
« Reply #2 on: February 22, 2014, 11:24:47 AM »
Hey ArenMook,

Thanks for the response.  Updated to 3.5.1, same problem. 

I found that if I set isEnabled = false and then disable and re-enable each game object (meaning the buttons), then the disabled/enabled background sprite update correctly. 

Also, when going from isEnabled = false to isEnabled = true (and not disabling/enabling the gameobject) if I mouse over (so the button changes to the hover state) it will then update to the correct 'Normal' sprite after I move the mouse away.

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIButton.isEnabled changes not updating background sprite
« Reply #3 on: February 23, 2014, 10:30:43 AM »
Alright, thanks, I will look into it.