I’ve just started playing around with the new system today so this might be a silly oversight, but I’m getting a couple of errors after exiting playmode.
I’ve hooked up two action maps, one for the player and another for the camera. The player just uses arrow keys / wasd and this works fine. For the camera I’ve set up a single binding for delta [Mouse]. This works in play mode and I can move the camera by hooking up a Move() method to performed. After exiting playmode however, I get four errors whenever I move the mouse. I’ve put them at the bottom of the post to avoid cluttering with a wall of text.
Here’s the callback related code:
private void Awake()
{
m_controls.Camera.Enable();
m_controls.Camera.Move.performed += Move;
}
private void OnDestroy()
{
m_controls.Camera.Move.performed -= Move;
}
private void Move(InputAction.CallbackContext ctx) { ... }
This is the same way the player controls are set up, so I’m not sure what the problem is here. Am I doing something wrong with the setup here?
Unity errors:
Map index out of range
UnityEngine.Experimental.Input.LowLevel.<>c__DisplayClass8_0:<set_onBeforeUpdate>b__0(NativeInputUpdateType)
UnityEngineInternal.Input.NativeInputSystem:NotifyBeforeUpdate(NativeInputUpdateType) (at C:/buildslave/unity/build/Modules/Input/Private/Input.cs:83)
Control index out of range
UnityEngine.Experimental.Input.LowLevel.<>c__DisplayClass8_0:<set_onBeforeUpdate>b__0(NativeInputUpdateType)
UnityEngineInternal.Input.NativeInputSystem:NotifyBeforeUpdate(NativeInputUpdateType) (at C:/buildslave/unity/build/Modules/Input/Private/Input.cs:83)
Binding index out of range
UnityEngine.Experimental.Input.LowLevel.<>c__DisplayClass8_0:<set_onBeforeUpdate>b__0(NativeInputUpdateType)
UnityEngineInternal.Input.NativeInputSystem:NotifyBeforeUpdate(NativeInputUpdateType) (at C:/buildslave/unity/build/Modules/Input/Private/Input.cs:83)
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Experimental.Input.InputActionState+BindingState.get_actionIndex () (at Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs:2356)
UnityEngine.Experimental.Input.InputActionState.ProcessControlStateChange (System.Int32 mapIndex, System.Int32 controlIndex, System.Int32 bindingIndex, System.Double time, UnityEngine.Experimental.Input.LowLevel.InputEventPtr eventPtr) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs:949)
UnityEngine.Experimental.Input.InputActionState.UnityEngine.Experimental.Input.LowLevel.IInputStateChangeMonitor.NotifyControlStateChanged (UnityEngine.Experimental.Input.InputControl control, System.Double time, UnityEngine.Experimental.Input.LowLevel.InputEventPtr eventPtr, System.Int64 mapControlAndBindingIndex) (at Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs:894)