Search Issue Tracker
By Design
Votes
0
Found in
2019.4
2020.3
2020.3.17f1
2021.1
2021.2
2022.1
Issue ID
1365684
Regression
No
Keycodes Less, Greater, LeftParen, RightParen are not being registered when using GetKeyDown
How to reproduce:
1. Open project "KeyCodes.zip"
2. Open "SampleScene" Scene (Assets>Scenes>SampleScene)
3. Enter the Play Mode
4. Open the Console window
5. Focus the Game window
6. Press the "K", "<"(Less), ">"(Greater), ","(Comma), "."(Period), "("(LeftParen), ")"(RightParen) keys
Expected result: Keys "<"(Less), ">"(Greater), "("(LeftParen), ")"(RightParen) are registered
Actual result: Keys "<"(Less), ">"(Greater), "("(LeftParen), ")"(RightParen) are not registered
Reproducible with: 2019.4.30f1, 2020.3.18f1, 2021.1.22f1, 2021.2.0b12, 2022.1.0a9
Notes:
-Keys ","(Comma) and "."(Period) are working
-When pressing Shift and Comma which should be "<"(Less) Editor registers Comma
-When pressing Shift and Period which should be ">"(Greater) Editor registers Period
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [macOS] Editor window is not restored to previous position when launching the Editor and mouse cursor is on a different screen
- [Usability] Warning message in an Adaptive Probe Volume Component is not informative enough when Realtime Global Illumination is enabled
- Inspector for Adaptive Probe Volumes is not repainted when toggling Realtime Global Illumination setting in the Lighting Window
- Surface Inputs are not rendering when using the custom BaseShaderGUI
- Reflection Problem custom Cubemap loses its reference when HDR is enabled and the platform is switched
Resolution Note:
In general broad sense, keyboard keycodes cannot be used for text input, because that will not work for many languages, for example try entering emoji's for example: there are no keycodes for emoji, or try using non-Latin keyboard, like for Japanese language.
Keycodes should only be representing hardware buttons on the keyboard, that way creating game controls like WASD and shortcuts is possible regardless what your current system language is selected. Meaning keycodes should be layout independent.
Currently UnityEngine.Input contains a very old bug, where keycodes where not layout independent on most platforms. We recently fixed it by introducing "Use Physical Keys" checkbox in Project Settings -> Input Manager in 2021. You can also use input system package to get access to layout independent keycodes. Going forward, Less/Greater/LeftParent/RightParent/many others will most likely be deprecated and removed.
So assuming Less/Greater/LeftParent/RightParent were needed for text entering purposes, the correct way to do it is via UnityEngine.Input.imeCompositionMode and UnityEngine.Input.compositionString, that way users of the app can enter text in any language. To sanity check text input implementation try entering emoji's or text in non-Latin languages.