From abd536144b8dffd9f524464b47ccc546fd10ae87 Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Mon, 27 May 2024 11:10:01 +0800 Subject: [PATCH 1/3] made sure action maps are disabled when switched made sure actionmaps are loaded after InputSystem.OnEnable --- .../Plugins/PlayerInput/PlayerInput.cs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs index 0dbfc82e16..f0685cb2ee 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs @@ -983,8 +983,22 @@ public void SwitchCurrentActionMap(string mapNameOrId) Debug.LogError($"Cannot find action map '{mapNameOrId}' in actions '{m_Actions}'", this); return; } - + + if (currentActionMap == null) + { + //Disabling all action maps, because we don't know which one is currently enabled + foreach(var i in m_Actions.actionMaps) + { + i.Disable(); + } + } + else + { + //Disabling the currently enabled action map + currentActionMap.Disable(); + } currentActionMap = actionMap; + currentActionMap.Enable(); } /// @@ -1621,6 +1635,11 @@ void Reset() #endif + private void Start() + { + ActivateInput(); + } + private void OnEnable() { m_Enabled = true; @@ -1630,7 +1649,6 @@ private void OnEnable() AssignPlayerIndex(); InitializeActions(); AssignUserAndDevices(); - ActivateInput(); } // Split-screen index defaults to player index. From 99fa13ba244eed7839f3ad7d6956e04207a0c828 Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Mon, 27 May 2024 11:13:30 +0800 Subject: [PATCH 2/3] update changelog --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 1a8cd8269e..28f04496db 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -15,6 +15,7 @@ however, it has to be formatted properly to pass verification tests. - Fixed an issue where a composite binding would not be consecutively triggered after ResetDevice() has been called from the associated action handler [ISXB-746](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-746). - Fixed resource designation for "d_InputControl" icon to address CI failure. - Fixed an issue where a composite binding would not be consecutively triggered after disabling actions while there are action modifiers in progress [ISXB-505](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-505). +- Fixed issue where all action maps default to enabled when InputSystem is enabled [ISXB-621](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-621). Now, only the default map is enabled. ## [1.8.2] - 2024-04-29 From 1382fe951fed36240e47255fdfc3227ad6cc490f Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Mon, 27 May 2024 11:37:45 +0800 Subject: [PATCH 3/3] format fix --- .../InputSystem/Plugins/PlayerInput/PlayerInput.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs index f0685cb2ee..19a82c7bad 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs @@ -983,11 +983,11 @@ public void SwitchCurrentActionMap(string mapNameOrId) Debug.LogError($"Cannot find action map '{mapNameOrId}' in actions '{m_Actions}'", this); return; } - + if (currentActionMap == null) { //Disabling all action maps, because we don't know which one is currently enabled - foreach(var i in m_Actions.actionMaps) + foreach (var i in m_Actions.actionMaps) { i.Disable(); }