From f81ee0679a584ff43af9d2f7503a77750cadbf4e Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Fri, 20 Feb 2026 19:29:40 +1100 Subject: [PATCH] Input: Fix action matching for projects saved before device ID change Normalize legacy device=0 on keyboard/mouse events when loading input actions from project settings. Before eadec6c605, these events defaulted to device=0; now they use DEVICE_ID_KEYBOARD (16) and DEVICE_ID_MOUSE (32), causing _find_event() mismatches. --- core/input/input_map.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index f0a050e880c..a808027d43f 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -205,6 +205,22 @@ void InputMap::action_add_event(const StringName &p_action, RequiredParamget_device() == 0) { + switch (p_event->get_type()) { + case InputEventType::KEY: + p_event->set_device(InputEvent::DEVICE_ID_KEYBOARD); + break; + case InputEventType::MOUSE_BUTTON: + case InputEventType::MOUSE_MOTION: + p_event->set_device(InputEvent::DEVICE_ID_MOUSE); + break; + default: + break; + } + } + input_map[p_action].inputs.push_back(p_event); }