Author Topic: UIKeyBinding works with UIButton.isEnabled == false  (Read 1422 times)

sisso

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 46
    • View Profile
UIKeyBinding works with UIButton.isEnabled == false
« on: June 12, 2014, 04:20:33 PM »
I don't know if works as intend or a missing feature. But in NGUI 3.6.1 it is possible to "click" in a button/toggle with UIKeyBinding even when its collider is disable with UIButton.isEnabled == false.

I will disabile it manually with the button, but could be nice if he knows that the widget is "disabled" and ignore the key event.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIKeyBinding works with UIButton.isEnabled == false
« Reply #1 on: June 13, 2014, 04:12:37 AM »
That's correct. The key binding script is a generic script that doesn't have to go on a button. It can go on an input field for example, or can even be used to select units by pressing keys like 1, 2, 3, etc. It wouldn't make much sense for it to check the button's disabled state.

I suggest account for this in your code. In most cases it makes sense to play an error sound anyway.