Author Topic: Stopping a button responding to input without using IsEnable  (Read 2706 times)

Cloun

  • Guest
Stopping a button responding to input without using IsEnable
« on: August 14, 2013, 09:15:40 AM »
We have menus that slide on and off the screen.  When a user releases a button, this starts a transition to move the menu page and it's items off screen, and during this transition we want to disable the buttons so the user cannot spam the screen with input (generating additional input audio etc.).

We don't do this using IsEnabled because this causes the button to switch to it's disabled colour.  Yes, technically it is disabled, but we don't want the button the player pressed suddenly changing to a disabled state, it should go back to the visible state it was before the pressed it.

Using IsEnabled also means we have to track what is enabled/disabled so when the menu has transitioned on, we only enabled the buttons that should be available to the player.

So we've done this by manually disabling the Box Colliders on buttons, but this has an issue that the button colours do not reset themselves to their normal state, they stays in it's hover state (I assume because the collider is disabled, it's no longer checking whether it is highlighted or not).  It also causes issues when the menu page first comes on because the button is getting confused as to what it's state should be.

So is there a way in nGui to simply flag a button to not receive any input, but stay in its 'active' state and reset to it's active state if you stop colliding with it once you've stopped it receiving input.

Cheers

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Stopping a button responding to input without using IsEnable
« Reply #1 on: August 15, 2013, 07:27:54 AM »
Use UIButtonColor instead of UIButton. It doesn't have a disabled color.