From 8d0e7416202ebf90ea58122e27d6614a8d832506 Mon Sep 17 00:00:00 2001 From: Morgan Hoarau Date: Wed, 18 Mar 2026 12:20:47 +0000 Subject: [PATCH] Update navigation state on move action swap --- .../InputSystem/Plugins/UI/InputSystemUIInputModule.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs index adba24a25e..dbdbb13314 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs @@ -1347,7 +1347,15 @@ public InputActionReference rightClick public InputActionReference move { get => m_MoveAction; - set => SwapAction(ref m_MoveAction, value, m_ActionsHooked, m_OnMoveDelegate); + set + { + SwapAction(ref m_MoveAction, value, m_ActionsHooked, m_OnMoveDelegate); + // Because moveAction is the only action cached in the navigation state, + // we need to read new action's current value to avoid stale state from the previous action. + m_NavigationState.move = m_MoveAction?.action != null && m_MoveAction.action.enabled + ? m_MoveAction.action.ReadValue() + : Vector2.zero; + } } ///