Skip to content

Instantly share code, notes, and snippets.

Last active Dec 22, 2018
What would you like to do?
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment