The entry for the Standalone Input Module specifically mentions
(Emphasis mine in both cases).
However, the interfaces (to be inherited by MonoBehaviours and called on the corresponding events) are listed here and clearly don’t involve any keyboard events.
So how do I handle keyboard input via the EventSystem? I know I can check directly which key is pressed in Update() calls, but that’s a different way of doing things altogether.
Thanks for getting my attention back in my thread – looks like we’re digging in the same functionality. Here’s what I found:
There is no exposed “key down” event anywhere. The only events that are fired through keyboard input are “move”, submit", and “cancel”.
The Event System game object that gets added to your scene with your UI canvas has the components that monitor for inputs (mouse, keyboard, controller) and translate them into the events. If you set the “First Selected” field of the EventSystem to a button in your UI, you should be able to move between the other selectable elements like buttons with the keyboard arrows and press enter (a key mapped to “submit” by default) to submit buttons. Once this is working correctly, the submit key will fire your button’s onClick event, so you don’t necessarily need the submit event I mentioned earlier.
A couple notes:
If you don’t have an EventSystem game object in your scene, you can go to GameObject > UI > Event System to add another one.
Check the input names in your Project Settings > Input Manager settings to make sure they match what you have listed for the Standalone Input Module attached to your Event System component.
If you don’t set “First Selected” (or call the Event System’s “SetSelectedGameObject(someGameObject)” method), pressing keyboard buttons won’t work. “First Selected” is just a starting point for the button navigation system; without that, the Event System doesn’t know where to go when keys are pressed.
The only keyboard keys the Event System/Standalone Input Module listen for are the ones mapped to the “submit” and “cancel” actions. (If you need more keys or more events than that, it gets a little messy, but it can be done by overriding some functionality from the Standalone Input Module.)