diff --git a/Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs b/Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs index 9b1e31dd75..30690878b2 100644 --- a/Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs @@ -236,7 +236,7 @@ public void Report(string message) } } - [Test(Description = "Verifies that the default asset do not generate any verification errors (Regardless of existing requirements)")] + [Test(Description = "Verifies that the default asset does not generate any verification errors (Regardless of existing requirements)")] [Category(kTestCategory)] public void ProjectWideActions_ShouldSupportAssetVerification_AndHaveNoVerificationErrorsForDefaultAsset() { diff --git a/Assets/Tests/InputSystem/Plugins/UITests.InputModuleTests.cs b/Assets/Tests/InputSystem/Plugins/UITests.InputModuleTests.cs index 7b32dd4ace..3b9df9f66c 100644 --- a/Assets/Tests/InputSystem/Plugins/UITests.InputModuleTests.cs +++ b/Assets/Tests/InputSystem/Plugins/UITests.InputModuleTests.cs @@ -157,6 +157,17 @@ public IEnumerator PointerExitChildShouldFullyExit() Assert.IsTrue(callbackCheck.pointerData.fullyExited == true); } + [UnityTest] + [Description("Regression test for https://jira.unity3d.com/browse/ISXB-1493")] + public IEnumerator DisablingDoesNotResetActions() + { + m_InputModule.enabled = false; + + yield return null; + + Assert.IsNotNull(m_InputModule.cancel, "Disabling component shouldn't lose its data."); + } + public class PointerExitCallbackCheck : MonoBehaviour, IPointerExitHandler { public PointerEventData pointerData { get; private set; } diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index a974f5a027..b27b56b3d0 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -24,6 +24,7 @@ however, it has to be formatted properly to pass verification tests. - Fixed Gamepad stick up/down inputs that were not recognized in WebGL. [ISXB-1090](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1090) - Fixed reenabling the VirtualMouseInput component may sometimes lead to NullReferenceException. [ISXB-1096](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1096) - Fixed the default button press point not being respected in Editor (as well as some other Touchscreen properties). [ISXB-1152](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1152) +- Fixed actions being reset when disabling the InputSystemUIInputModule component [ISXB-1493](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1493) - Fixed PlayerInput component automatically switching away from the default ActionMap set to 'None'. - Fixed a console error being shown when targeting visionOS builds in 2022.3. - Fixed a Tap Interaction issue with analog controls. The Tap interaction would keep re-starting after timeout. [ISXB-627](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-627) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs index 756e192e88..bdac8c9a63 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs @@ -1528,6 +1528,17 @@ public InputActionReference trackedDevicePosition set => SwapAction(ref m_TrackedDevicePositionAction, value, m_ActionsHooked, m_OnTrackedDevicePositionDelegate); } + // We should dispose the static default actions thing because otherwise it will survive domain reloads + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] + static void ResetDefaultActions() + { + if (defaultActions != null) + { + defaultActions.Dispose(); + defaultActions = null; + } + } + /// /// Assigns default input actions asset and input actions, similar to how defaults are assigned when creating UI module in editor. /// Useful for creating at runtime. @@ -1665,7 +1676,6 @@ protected override void OnDisable() InputActionState.s_GlobalState.onActionControlsChanged.RemoveCallback(m_OnControlsChangedDelegate); DisableAllActions(); UnhookActions(); - UnassignActions(); base.OnDisable(); }