0 votes

I solved my problem, the error message was missleading


i have build a system were all key short cuts are listed. after the player changes some short cuts he can press save and InputMap should rebuild. but there is one part i could not accomplish yet, the (re)adding of the keys:

#...code to clean up InputMap etc
var event = InputEvent()
event.type = InputEvent.KEY
event.scancode = new_key #error here
InputMap.action_add_event(action, event )

I saw examples were "InputEvent" had the attribute "scancode" but i gues this changed. I did try "InputEventKey()" instead of "InputEvent()" because i found it in the docs and thought it an inherited type that could work (it hat the attribute "scancode" but it says it does not know "InputEventKey" at all.

so how can i add a specific key to an action?

in Engine by (295 points)
edited by

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 Frequently asked questions and 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 [email protected] with your username.