Skip to content

Instantly share code, notes, and snippets.

@ijoschek ijoschek/.\scene_1.gd Secret
Last active Dec 22, 2018

Embed
What would you like to do?
godot_custom_keybind_tut
func _change_key(new_key):
#Delete key of pressed button
if !InputMap.get_action_list(action_string).empty():
InputMap.action_erase_event(action_string, InputMap.get_action_list(action_string)[0])
#Check if new key was assigned somewhere
for i in ACTIONS:
if InputMap.action_has_event(i, new_key):
InputMap.action_erase_event(i, new_key)
#Add new Key
InputMap.action_add_event(action_string, new_key)
_set_keys()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.