summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2024-01-18 19:27:06 +0100
committerYuri Sizov <yuris@humnom.net>2024-01-18 19:27:06 +0100
commit2ababdcc065e76decc12747a3c84e01f7bdc90dd (patch)
treeab4eee20a0dc23e17fd3707eb82c17dd50de8ae1
parent6fa577cada40e47409e443f648cf3f1e30c65753 (diff)
parent4b3a12f4eefdb070bb090ad0a40931de304a897e (diff)
downloadredot-engine-2ababdcc065e76decc12747a3c84e01f7bdc90dd.tar.gz
Merge pull request #87324 from jsjtxietian/action-exist
Check action exists in `Input.action_press` and `action_release`
-rw-r--r--core/input/input.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp
index 2ba4b1d1e8..4e33d3087d 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -865,6 +865,8 @@ Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, con
}
void Input::action_press(const StringName &p_action, float p_strength) {
+ ERR_FAIL_COND_MSG(!InputMap::get_singleton()->has_action(p_action), InputMap::get_singleton()->suggest_actions(p_action));
+
// Create or retrieve existing action.
ActionState &action_state = action_states[p_action];
@@ -879,6 +881,8 @@ void Input::action_press(const StringName &p_action, float p_strength) {
}
void Input::action_release(const StringName &p_action) {
+ ERR_FAIL_COND_MSG(!InputMap::get_singleton()->has_action(p_action), InputMap::get_singleton()->suggest_actions(p_action));
+
// Create or retrieve existing action.
ActionState &action_state = action_states[p_action];
action_state.cache.pressed = 0;