Search Issue Tracker

By Design

Votes

0

Found in

2020.3.42f1

2021.3.16f1

2022.1.24f1

2022.2.1f1

2023.1.0a23

Issue ID

UUM-21917

Regression

No

Input.GetKey() does not log symbols when using a Japanese keyboard

--

-

Reproduction steps:

# Download and activate the “Japanese - Romaji” keyboard
# Open the attached project “GetKeyRepro.zip”
# Enter Play Mode
# Try pressing +, = and ; buttons
# Check the console for output

Expected result: The values are logged and the message “Pressed +” etc. is displayed
Actual result: The function Input.GetKeyDown does not log nor recognize these symbols on the Japanese keyboard

Reproducible with: 2020.3.42f1, 2021.3.16f1, 2022.1.24f1, 2022.2.1f1, 2023.1.0a23

Reproducible on: MacOS 12.2.1 (Intel), Windows 10

  1. Resolution Note:

    Unity input system key codes and input manager key codes are designed with game controls in mind, that means pressing the same location on a keyboard should result in the same action regardless of what is printed on a key or what current system language is set. Unity relies on physical hardware in the keyboards to report same USB HID "usage" for the keys in the same location. There is a practical limit what could be achieved here as different keyboards might report different data, and this is outside of Unity control.

    When trying to use key codes for text input this is a wrong tool to do that. Instead `Keyboard.current.onTextInput` callback should be used, this will provide actual text characters that are printed on a keyboard keys based on current system language layout.

    When trying to use key codes for shortcuts it will not be as trivial, as neither key code or display name is sufficient to provide natively feeling shortcuts, please refer to Visual Studio Code wiki for more information how to implement natively feeling shortcuts https://github.com/microsoft/vscode/wiki/Keybinding-Issues#how-it-works-on-windows

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.