Search Issue Tracker

Feature Request

Votes

0

Found in

2022.3.61f1

6000.0.47f1

6000.1.0b15

6000.2.0a9

6000.3.0a1

Issue ID

UUM-103266

Regression

No

DisplayName returns QWERTY keyboard key value and not the OS keyboard value when used in a WebGL build

-

How to reproduce:

1. Open the project: “IN-98768_Input”
2. Click File → Build and Run
3. Open the Browsers Console
4. Make sure to switch to a Cyrillic alphabet keyboard layout in your OS
5. Press the “g” key on the keyboard
6. Observe the Browser Console

Expected result: The Console prints out “Display Name: п”
Actual result: The Console prints out “Display Name: g”

Reproducible with: 2022.2.0a1, 2022.3.61f1, 6000.0.47f1, 6000.1.0b15, 6000.2.0a9

Reproducible on: Windows 11
Not reproducible on: No other environments tested

  1. Resolution Note:

    We believe this is a feature request, since the implementation for this API does not exist. We're closing this bug and have opened a new feature request ticket: https://jira.unity3d.com/browse/PLAT-15340.

Comments (2)

  1. mobileappdevelopmentae

    Apr 16, 2025 11:06

    Hey, thanks for sharing this!

    Yeah, I can confirm this behavior as well—DisplayName in WebGL builds seems to return the key as mapped on the QWERTY layout, not based on the OS-level keyboard layout. So when you're using a Cyrillic layout and press "g", it still returns "g" instead of "п".

    It looks like WebGL's input system relies on the underlying JavaScript KeyboardEvent.code or key, which is tied to the physical key rather than the character mapped in the OS layout. That’s probably why it behaves differently compared to native platforms.

    We encountered a similar limitation when developing a multilingual chat interface for a mobile app development company in Dubai—to support localized input in WebGL, we had to capture raw key events at the browser level using a JavaScript plugin and pass that into Unity via SendMessage().

    So unless Unity changes how WebGL input works or gives more flexibility, a workaround could be custom JS to fetch KeyboardEvent.key and forward it into Unity.

    Let me know if you’d like help setting up a basic plugin for that!

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.