From 00c631b13cb412fda045ecb45d1da4aa33b74fab Mon Sep 17 00:00:00 2001 From: Tomasz Chabora Date: Tue, 3 Nov 2020 11:22:15 +0100 Subject: [PATCH] Release pressed action if event is removed (cherry picked from commit b7c612bd54cd1b1a9e8285f736f41c8a9dc4a2e2) --- core/input_map.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/input_map.cpp b/core/input_map.cpp index ec833659f49..ed91edb387a 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -30,6 +30,7 @@ #include "input_map.h" +#include "core/os/input.h" #include "core/os/keyboard.h" #include "core/project_settings.h" @@ -153,8 +154,12 @@ void InputMap::action_erase_event(const StringName &p_action, const Ref >::Element *E = _find_event(input_map[p_action], p_event); - if (E) + if (E) { input_map[p_action].inputs.erase(E); + if (Input::get_singleton()->is_action_pressed(p_action)) { + Input::get_singleton()->action_release(p_action); + } + } } void InputMap::action_erase_events(const StringName &p_action) {