-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InputMap.get_action_list() doesn't return Joypad buttons when called in the editor #54950
Comments
From a quick look in |
Could be because in editor it uses editor actions (default) and at runtime it uses the input map from project settings? |
You might be on to something. Just tested this on a custom action and not one of the built-ins and it didn't show anything in the editor at all. |
I can't find where this would be implemented, but I think the editor ignores joypad input on purpose, due to #16832. |
This is by design. Godot engine is a game; so it has its own, fixed InputMap which is loaded and used by the editor and the project manager: Lines 1257 to 1263 in 28174d5
When you call InputMap.get_action_list("ui_accept") (or InputMap.action_get_events("ui_accept") in 4.0) within the editor you get the editor's InputMap , which is limited to those key mappings.To get the project's InputMap 's Action 's events, you need to use ProjectSettings.get_setting("input/ui_accept").events .
|
@madmiraal Is this documented anywhere? |
Not that I know of. |
Godot version
3.4.stable
System information
Windows 10
Issue description
When you call InputMap.get_action_list() in a tool script in the editor, it only returns keyboard buttons. Joypad buttons, axes, mouse buttons, and physical keyboard buttons don't show up. This only happens in the editor, when running the game it returns all the different types of controls as you'd expect.
I've tested this in 3.4 and 3.2.3 and they both have the same behavior.
(This has put a slight damper on my button prompt node that grabs button graphics based off of your Input Map. 😢)
Steps to reproduce
Create a Node2D with the following script:
In the editor it will print:
[[InputEventKey:60], [InputEventKey:61], [InputEventKey:62]]
(The numbers might be different for you)
If you play the project it will print:
[[InputEventKey:20], [InputEventKey:21], [InputEventKey:22], [InputEventJoypadButton:23]]
Notice when running in the editor it's missing the InputEventJoypadButton, but when playing the project it outputs all the buttons as expected.
If you add Joypad Axes, Mouse Buttons, or Physical Keyboard Buttons to ui_accept, you'll find that they're also missing in the editor as well.
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: