Author Topic: Suggestion/Request for Input key handling  (Read 2730 times)

AeornFlippout

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 46
    • View Profile
Suggestion/Request for Input key handling
« on: March 16, 2013, 12:07:55 PM »
I'm working on getting proper controller/keyboard support working for our UI.

One unfortunate thing is that UICamera specifies the buttons/keys for input (submitKey1, etc.) in terms of raw keyboard/button input, using KeyCodes.

This works OK for sample projects, but we're shipping for PC, Mac and Linux, and these keycodes are far from universally useful. For instance my 360 controller driver doesn't work with the controller input demo. We need to be able to allow users to configure their controller buttons as they see fit - including the buttons used for menu navigation.

And while I see that we can just change the submitKey1 to a different button, unfortunately, Unity's input system doesn't provide a reverse lookup mechanism for us to see which keyboard/joystick button would be appropriate.

It would be more in keeping with Unity's input system if NGUI instead looked for virtual "Buttons" and used Input.GetButtonDown() and left it up to the project to map the appropriate buttons, perhaps with some instructions in the documentation telling people to setup some mappings for "MenuAction", "MenuBack" etc. in their project's input settings.

Does this seem like a reasonable change/addition?
I'll likely make the change in our local version of UICamera, and I'd be happy to submit a unified diff.

-Aaron