I am loading keybinds from a file and I want to set them into the InputMap, but when I do it using InputMap.actionaddevent() it doesn't add, when I press the key nothing happens.
Here is my code for setting keybinds:
func _input(event):
if event is InputEventKey and selected:
keybind = OS.get_scancode_string(event.unicode)
selected = false
After that I save everything to a file when the window is closed.
Then to set a keybind I use this code:
func set_specific_keybind(action, keybind): # Sets a specific keybind
delete_specific_keybind(action)
var key = InputEventKey.new()
key.scancode = int(keybind)
InputMap.action_add_event(action, key)
Deletespecifickeybind just calls InputMap.actioneraseevents().
If anyone has a solution for this, that would be helpful, it's probably some silly mistake that I made.