0 votes

Hey,

I know that it is possible to get the InputEventKey unicode when a key is pressed, but how can I get a unicode of a scancode in the code and without a key pressed event?

I'm currently working on a controls menu, where the player can change the key bindings and I'm having problems displaying the correct key in the UI.

Everything works fine when the player presses a key as I can get the unicode and display it correctly. But how about on _ready, when I load the saved scancodes? Is there a way to convert a scancode to unicode?

Thanks,

Godot version 3.3
in Engine by (42 points)

The following code works correctly inside the _input(event) method:

text = char(event.unicode)

Exemple: On PT-BR keyboard, I hit BraceRight and It shows " [ " as expected.

But how to get this info outside an input event? For example when I load all the scancodes from a file when adding to the InputMap. In the same example, the result will be "BraceRight".

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.