Get physical key name

Godot Version

v4.3.dev3.official

Question

How do I get the physical name of a key based on the event name? We used to have a lot of useful functions to do that but all the issues I found online are outdated because of Godot 4…

Sorry I’m a beginer, how do I get that InputEventKey object from the event name?

Anyone?

the InputEventKey is the object you get from an _input or _unhandled_input callback.
Can you share some code so we can help you better ?

1 Like

Not sure if this is what you’re looking for:

    for input_event in InputMap.action_get_events("ui_accept"):
        print(input_event.as_text())

prints:

Enter
Kp Enter
Space

You can print it without as_text() for all the event information (like keycode)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.