-
-
Save ijoschek/77d1118d0a3625fb1aaddead43e45e12 to your computer and use it in GitHub Desktop.
godot_custom_keybind_tut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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