func set_text_for_key() → void:
if InputMap.has_action(action_name):
var action_events = InputMap.action_get_events(action_name)
print(“Action events for”, action_name, “:”, action_events)
func _on_button_toggled(toggled_on):
if toggled_on:
button.text = “Press any key…”
set_process_unhandled_key_input(toggled_on)
for i in get_tree().get_nodes_in_group("hotkey_button"):
if i.action_name != self.action_name:
i.button.toggle_mode = false
i.set_process_unhandled_key_input(false)
else:
for i in get_tree().get_nodes_in_group("hotkey_button"):
if i.action_name != self.action_name:
i.button.toggle_mode = true
i.set_process_unhandled_key_input(false)
set_text_for_key()
I changed my print output to print(“Action events for”, action_name, “:”, action_events) which prints a mess but if I change it back to print(action_events) then it would print the above
The only possible issue that I see right now is that the action_name variable is a @export variable which means that you may unintentionally have changed its initial value in the editor.