Author Topic: Disable WASD input for UIButtonKeys, use arrow keys only  (Read 2075 times)

Multiplayer

  • Guest
Disable WASD input for UIButtonKeys, use arrow keys only
« on: May 26, 2013, 05:31:51 AM »
Hi

I would like to use the UIButtonKeys script to navigate my menus via keyboard. So far this is working great, but I only want to use the arrow keys for navigation. All other keys, including WASD and TAB, should be free to be used as input for custom player controls.

Is there a way to have the UIButtonKeys script react to the arrow keys only?

Edit:
I found out I can overwrite the behavior of which inputs are able to trigger anything in the UICamera Script. I don't really like to mess with external scripts that way, so a simpler solution will still be appreciated. But it seems this will work for now.
« Last Edit: May 26, 2013, 06:53:41 AM by Multiplayer »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Disable WASD input for UIButtonKeys, use arrow keys only
« Reply #1 on: May 26, 2013, 12:49:43 PM »
Yeah in your case modifying the UICamera is the way to go. Another alternative is to do it yourself in Update() using Input.GetKeyDown() after checking UICamera.selectedObject == gameObject.