I’m having a issue with the new input system.
In an .inputasset asset, I have my maps and actions set. But when disabling a map and enabling another I’m receiving the erros (5 erros in total) added on the end of this post.
They are all triggered after the matikaInputActionsAsset.matikaInputActions.Dialogue.Enable()
This is done after the game is running and I change maps because player is entering a dialogue.
I was able to pin point the error to when the newly enabled map has a Binding with a path to a Gamepad button, this error occurs, when I remove this Binding from the action, the error doesn’t show up.
I tried to reproduce it on a small project but wasn’t able to reproduce the error.
I’m using a ScriptableObject that has a instance of the generated InputActionAsset, and using it whenever a system need access to it. I dont think this has any relation with the issue.
From what I understand, the out of range exceptions has something to do with the number of each ActionMap (like iterating on the wrong map). Could also be related to the number of the Actions or the number of bindings, but only really happens when there is a binding to a Gamepad button (button west on my case). (I’m always using the keyboard binding to reproduce the erro)
I can run tests and answer question to help pinpoint the issue since this is 100% reproducible, and with some direction we might be able to create a small project with the problem.
I’m using a Input Asset 1.5.0 ( also happens on 1.3.0) and Unity 2021.1.28f1
I thought i could have something to do with the fix on 1.4.0 (Fixed IndexOutOfRangeException when having multiple interactions on an action and/or binding in an action map other than the first of an asset (case 1392559).) but after updating to 1.5.0, the issue remained.
Any suggestions?
matikaInputActionsAsset.matikaInputActions.PlayerControls.Disable();
matikaInputActionsAsset.matikaInputActions.Dialogue.Enable();
matikaInputActionsAsset.matikaInputActions.Map.Disable();
Assertion failed
UnityEngine.InputSystem.InputActionMap:Enable ()
IndexOutOfRangeException: Index was outside the bounds of the array.
UnityEngine.InputSystem.InputManager.AddStateChangeMonitor (UnityEngine.InputSystem.InputControl control, UnityEngine.InputSystem.LowLevel.IInputStateChangeMonitor monitor, System.Int64 monitorIndex, System.UInt32 groupIndex) (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/InputManagerStateMonitors.cs:35)
UnityEngine.InputSystem.InputActionState.EnableControls (System.Int32 mapIndex, System.Int32 controlStartIndex, System.Int32 numControls) (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/Actions/InputActionState.cs:1134)
UnityEngine.InputSystem.InputActionState.EnableControls (UnityEngine.InputSystem.InputActionMap map) (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/Actions/InputActionState.cs:947)
UnityEngine.InputSystem.InputActionState.EnableAllActions (UnityEngine.InputSystem.InputActionMap map) (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/Actions/InputActionState.cs:907)
UnityEngine.InputSystem.InputActionMap.Enable () (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/Actions/InputActionMap.cs:541)
MatikaInputActions+DialogueActions.Enable () (at Assets/Settings/Input Actions/MatikaInputActions.cs:1761)
Control index out of range
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)
Exception 'ArgumentNullException' thrown from state change monitor 'InputActionState' on 'Key:/Keyboard/f'
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)
ArgumentNullException: Value cannot be null.
Parameter name: control
UnityEngine.InputSystem.InputControlExtensions.CheckStateIsAtDefault (UnityEngine.InputSystem.InputControl control) (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/Controls/InputControlExtensions.cs:498)
UnityEngine.InputSystem.InputActionState.ProcessControlStateChange (System.Int32 mapIndex, System.Int32 controlIndex, System.Int32 bindingIndex, System.Double time, UnityEngine.InputSystem.LowLevel.InputEventPtr eventPtr) (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/Actions/InputActionState.cs:1448)
UnityEngine.InputSystem.InputActionState.UnityEngine.InputSystem.LowLevel.IInputStateChangeMonitor.NotifyControlStateChanged (UnityEngine.InputSystem.InputControl control, System.Double time, UnityEngine.InputSystem.LowLevel.InputEventPtr eventPtr, System.Int64 mapControlAndBindingIndex) (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/Actions/InputActionState.cs:1326)
UnityEngine.InputSystem.InputManager.FireStateChangeNotifications (System.Int32 deviceIndex, System.Double internalTime, UnityEngine.InputSystem.LowLevel.InputEvent* eventPtr) (at Library/PackageCache/com.unity.inputsystem@1.5.0/InputSystem/InputManagerStateMonitors.cs:380)
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)