InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

The second binding for an InputAction triggers an IndexOutOfRangeException

Open jackpr-unity opened this issue 8 years ago • 4 comments

Reproduction Steps:

  1. Create a script with a public InputAction
  2. In the script Start() function, enable the action
  3. Create a gameobject, attach the script, and add at least 2 bindings.
  4. Press play and activate the second binding

Alternatively, here is a repro scene all set up: ActionTest.zip

Expected Result: The action is performed with no errors.

Observed Result: An IndexOutOfRangeException is triggered

Tested with 2018.2.0b1 and commit e216c7333858a2682b37964721f54201580565f9

Stack Trace: IndexOutOfRangeException: Array index is out of range. UnityEngine.Experimental.Input.Utilities.ReadWriteArray`1[UnityEngine.Experimental.Input.InputActionSet+ModifierState].get_Item (Int32 index) (at Packages/com.unity.inputsystem/InputSystem/Utilities/ReadWriteArray.cs:65) UnityEngine.Experimental.Input.InputAction.NotifyControlValueChanged (UnityEngine.Experimental.Input.InputControl control, Int32 bindingIndex, Double time) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputAction.cs:802) UnityEngine.Experimental.Input.InputManager.FireActionStateChangeNotifications (Int32 deviceIndex, Double time) (at Packages/com.unity.inputsystem/InputSystem/InputManager.cs:1996) UnityEngine.Experimental.Input.InputManager.OnUpdate (InputUpdateType updateType, Int32 eventCount, IntPtr eventData) (at Packages/com.unity.inputsystem/InputSystem/InputManager.cs:1861) UnityEngine.Experimental.Input.LowLevel.NativeInputRuntime+<>c__AnonStorey0.<>m__0 (NativeInputUpdateType updateType, Int32 eventCount, IntPtr eventPtr) (at Packages/com.unity.inputsystem/InputSystem/NativeInputRuntime.cs:57) UnityEngineInternal.Input.NativeInputSystem.NotifyUpdate (NativeInputUpdateType updateType, Int32 eventCount, IntPtr eventData) (at C:/Users/jackpr/Ono/unity/Modules/Input/Private/Input.cs:90)

jackpr-unity avatar Apr 23 '18 21:04 jackpr-unity

Are you on latest head? The line numbers suggest you're running old code.

I've tried this on latest head but couldn't reproduce. Your scene runs fine.

Rene-Damm avatar Apr 24 '18 00:04 Rene-Damm

Actually, while I don't see an exception, what I see is that there's no response on the action either. Looking at it.

(And NVM re before, just realized you linked the commit you tested with)

Rene-Damm avatar Apr 24 '18 00:04 Rene-Damm

Make sure you focused the game window. Also, in case it matters, I'm running on Windows.

jackpr-unity avatar Apr 24 '18 00:04 jackpr-unity

Can no longer reproduce with commit 7948ead2797c9551010b7e90017852ad3669b139

jackpr-unity avatar Apr 26 '18 17:04 jackpr-unity