diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 889f54e6ae..eb6d7804f4 100755 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -14,6 +14,7 @@ however, it has to be formatted properly to pass verification tests. - Fixed `ArgumentNullException` when opening the Prefab Overrides window and selecting a component with an `InputAction`. - Fixed `{fileID: 0}` getting appended to `ProjectSettings.asset` file when building a project ([case ISXB-296](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-296)). - Fixed `Type of instance in array does not match expected type` assertion when using PlayerInput in combination with Control Schemes and Interactions ([case ISXB-282](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-282)). +- Fixed an InvalidOperationException when using Hold interaction, and by extension any interaction that changes to performed state after a timeout ([case ISXB-332](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-330)). ## [1.4.3] - 2022-09-23 diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs index 683bcdedfb..d9256ffe9d 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs @@ -2403,7 +2403,11 @@ private void ChangePhaseOfActionInternal(int actionIndex, TriggerState* actionSt // When we perform an action, we mark the event handled such that FireStateChangeNotifications() // can then reset state monitors in the same group. // NOTE: We don't consume for controls at binding complexity 1. Those we fire in unison. - if (controlGroupingAndComplexity[trigger.controlIndex * 2 + 1] > 1) + if (controlGroupingAndComplexity[trigger.controlIndex * 2 + 1] > 1 && + // we can end up switching to performed state from an interaction with a timeout, at which point + // the original event will probably have been removed from memory, so make sure to check + // we still have one + m_CurrentlyProcessingThisEvent.valid) m_CurrentlyProcessingThisEvent.handled = true; } else if (newPhase == InputActionPhase.Canceled)