Author Topic: UIImageButton disabled doesn't always work based on order of operations  (Read 1782 times)

KyleStaves

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Hello,

I just wanted to submit a quick bug/fix. Depending on how the execution order goes, it's possible for a UIImageButton to immediately flicker back from the disabled sprite to the hover sprite (my script calls imageButton.isEnabled = false, then within the same frame the UICamera passes the OnHover event to the ImageButton). I fixed this locally by asking if (enabled && isEnabled && target != null) instead of if (enabled && target != null) in the OnHover method of ImageButton.cs

Not sure if you want to add this to the main release or if there's a more efficient way to fix the issue, just thought it may help someone (and hopefully it does get included so I don't have to remember to re-fix upon updating :D).

Best,
Kyle

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
The latest version has it at "if (isEnabled && target != null)". You should update!

KyleStaves

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Oh excellent, thanks!