here’s an example with all the pre-enabled actions removed:
var actionArray = []
func _ready():
prune_actionArray()
func prune_actionArray():
actionArray = InputMap.get_actions()
for i in [&"ui_accept", &"ui_select", &"ui_cancel", &"ui_focus_next", &"ui_focus_prev", &"ui_left",
&"ui_right", &"ui_up", &"ui_down", &"ui_page_up", &"ui_page_down", &"ui_home", &"ui_end", &"ui_cut",
&"ui_copy", &"ui_paste", &"ui_undo", &"ui_redo", &"ui_text_completion_query", &"ui_text_completion_accept",
&"ui_text_completion_replace", &"ui_text_newline", &"ui_text_newline_blank", &"ui_text_newline_above",
&"ui_text_indent", &"ui_text_dedent", &"ui_text_backspace", &"ui_text_backspace_word",
&"ui_text_backspace_word.macos", &"ui_text_backspace_all_to_left", &"ui_text_backspace_all_to_left.macos",
&"ui_text_delete", &"ui_text_delete_word", &"ui_text_delete_word.macos", &"ui_text_delete_all_to_right",
&"ui_text_delete_all_to_right.macos", &"ui_text_caret_left", &"ui_text_caret_word_left",
&"ui_text_caret_word_left.macos", &"ui_text_caret_right", &"ui_text_caret_word_right",
&"ui_text_caret_word_right.macos", &"ui_text_caret_up", &"ui_text_caret_down", &"ui_text_caret_line_start",
&"ui_text_caret_line_start.macos", &"ui_text_caret_line_end", &"ui_text_caret_line_end.macos",
&"ui_text_caret_page_up", &"ui_text_caret_page_down", &"ui_text_caret_document_start",
&"ui_text_caret_document_start.macos", &"ui_text_caret_document_end", &"ui_text_caret_document_end.macos",
&"ui_text_caret_add_below", &"ui_text_caret_add_below.macos", &"ui_text_caret_add_above",
&"ui_text_caret_add_above.macos", &"ui_text_scroll_up", &"ui_text_scroll_up.macos", &"ui_text_scroll_down",
&"ui_text_scroll_down.macos", &"ui_text_select_all", &"ui_text_select_word_under_caret",
&"ui_text_select_word_under_caret.macos", &"ui_text_add_selection_for_next_occurrence",
&"ui_text_clear_carets_and_selection", &"ui_text_toggle_insert_mode", &"ui_menu", &"ui_text_submit",
&"ui_graph_duplicate", &"ui_graph_delete", &"ui_filedialog_up_one_level", &"ui_filedialog_refresh",
&"ui_filedialog_show_hidden", &"ui_swap_input_direction"]:
actionArray.erase(i)
Then instead of “InputMap.get_actions()” you would put actionArray.
going even further faster if you keep a naming convention for your actions in specific scripts you could have a pruning function like this:
func prune_actionArray():
for i in InputMap.get_actions():
if "camera" in i:
actionArray.append(i)
this is what I’m using for camera controls in my RTS project.
and to make this post actually address the question, you can pass Input into the what_action_is_event() function:
var action = what_action_is_event(Input)
match action:
"camera_move_right":
position.x += 10
etc.