Input Actions key assignment mismatch
I use the latest versions of InputSystem and Units 2019.2.0b I try to assign an key to input actions. (German QWERTZ Keyboard)
Action type = key, and in the binding path I selected "keyboard z" with typing z in the search field. This works like I want this.
Running the game I have to use the US layout (German keyboard y).
This different behavior sucks. Can we have different types (key = hardware / char = mapped key) or so??
@Rene-Damm can explain this design decision better, but I believe each key is bind to a physical location instead of the key code (for lack of better phrase.) I suspect to achieve this, you'll have to have different input maps to switch between, depends on what keyboard layout you have at the moment.
This design where "a" doesn't mean "a" is very non-intuitive when writing code. If the key name was "aPositionUS" then at least we'd know not to expect that actual letter in all cases.
Franky, having worked with and implemented input listeners several times over the years, the keyboard portion of InputSystem is a mess. The designers should strive to make it at least as intuitive and usable as Java's old Swing system: https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyListener.html
Is it too late to re-write the keyboard section so deeply?
I've added a TODO to add a simple wrapper to look up keys by display name. ATM you need to either do something like
Keyboard.current.allKeys.FirstOrDefault(x => x.displayName = "a")
or perform the lookup up using a path
Keyboard.current["#{a}"]
Franky, having worked with and implemented input listeners several times over the years, the keyboard portion of InputSystem is a mess. The designers should strive to make it at least as intuitive and usable as Java's old Swing system: https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyListener.html
This is not a good API for games where you need stable, physical mapping. VK_A will move around.
For text input, onTextInput is usually the better choice than manually mapping from individual keys. However, doing so is possible by binding / lookup up by display names. Granted, the current API makes that pedestrian in nature. Will add a nice wrapper.