Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Errors throwns when Delta [Mouse] has a Scale Vector 2 processor in OnDisable of PlayerInput.

Discussion in 'Input System' started by Q-Ted, Sep 13, 2022.

  1. Q-Ted

    Q-Ted

    Joined:
    Dec 16, 2016
    Posts:
    46
    Hello,

    I'm using Unity 2022.1.12f1 with the Input System 1.4.2 package. I could only reproduce it with the mouse delta, but I have not tested every vector 2.

    My action is setup as follows:
    Action Map: "Player"
    Action: "Rotation", Value: Vector2
    Binding: "Right Stick [Gamepad]", Control scheme: Controller
    Binding: "Delta [Mouse]", Control scheme: Mouse&Keyboard, Processor: Scale Vector 2 (0.1, 0.1)​

    3 errors get thrown in the OnDisable function of the PlayerInput class:

    NullReferenceException while resolving binding 'Rotation:<Mouse>/delta[Mouse&Keyboard]' in action map 'InputActions (UnityEngine.InputSystem.InputActionAsset):player'
    UnityEngine.InputSystem.PlayerInput:OnDisable () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInput.cs:1734)

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.InputSystem.InputBindingResolver.InstantiateWithParameters[TType] (UnityEngine.InputSystem.Utilities.TypeTable registrations, System.String namesAndParameters, TType[]& array, System.Int32& count, UnityEngine.InputSystem.InputActionMap actionMap, UnityEngine.InputSystem.InputBinding& binding) (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputBindingResolver.cs:638)
    UnityEngine.InputSystem.InputBindingResolver.AddActionMap (UnityEngine.InputSystem.InputActionMap actionMap) (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputBindingResolver.cs:304)
    UnityEngine.InputSystem.PlayerInput:OnDisable() (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInput.cs:1734)

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.InputSystem.InputBindingResolver.InstantiateWithParameters[TType] (UnityEngine.InputSystem.Utilities.TypeTable registrations, System.String namesAndParameters, TType[]& array, System.Int32& count, UnityEngine.InputSystem.InputActionMap actionMap, UnityEngine.InputSystem.InputBinding& binding) (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputBindingResolver.cs:638)
    UnityEngine.InputSystem.InputBindingResolver.AddActionMap (UnityEngine.InputSystem.InputActionMap actionMap) (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputBindingResolver.cs:592)
    UnityEngine.InputSystem.InputActionMap.ResolveBindings () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputActionMap.cs:1352)
    UnityEngine.InputSystem.InputActionMap.ResolveBindingsIfNecessary () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputActionMap.cs:1217)
    UnityEngine.InputSystem.InputActionState.DeferredResolutionOfBindings () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputActionState.cs:4449)
    UnityEngine.InputSystem.InputActionRebindingExtensions+DeferBindingResolutionWrapper.Dispose () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputActionRebindingExtensions.cs:2807)
    UnityEngine.InputSystem.PlayerInput.OnDisable () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInput.cs:1734)
    The inspector also throws 3 errors after the above errors are thrown:
    ArgumentNullException: Value cannot be null.
    Parameter name: source
    System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at <a8d5ce651b9742ecb5c87f14df5ab000>:0)
    System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value) (at <a8d5ce651b9742ecb5c87f14df5ab000>:0)
    UnityEngine.InputSystem.InputActionState.FetchActionState (UnityEngine.InputSystem.InputAction action) (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputActionState.cs:887)
    UnityEngine.InputSystem.InputAction.get_currentState () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputAction.cs:1492)
    UnityEngine.InputSystem.InputAction.get_phase () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputAction.cs:508)
    UnityEngine.InputSystem.InputAction.get_enabled () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputAction.cs:533)
    UnityEngine.InputSystem.InputActionAsset.FindAction (System.String actionNameOrId, System.Boolean throwIfNotFound) (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputActionAsset.cs:549)
    UnityEngine.InputSystem.Editor.PlayerInputEditor.OnActionAssetChange () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs:443)
    UnityEngine.InputSystem.Editor.PlayerInputEditor.OnInspectorGUI () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs:77)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass62_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <ebb02a01ca6f421580a8e2b277849760>:0)
    UnityEditor.InspectorWindow:RedrawFromNative()

    ArgumentNullException: Value cannot be null.
    Parameter name: source
    System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at <a8d5ce651b9742ecb5c87f14df5ab000>:0)
    System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value) (at <a8d5ce651b9742ecb5c87f14df5ab000>:0)
    UnityEngine.InputSystem.InputActionState.FetchActionState (UnityEngine.InputSystem.InputAction action) (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputActionState.cs:887)
    UnityEngine.InputSystem.InputAction.get_currentState () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputAction.cs:1492)
    UnityEngine.InputSystem.InputAction.get_phase () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputAction.cs:508)
    UnityEngine.InputSystem.InputAction.get_enabled () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputAction.cs:533)
    UnityEngine.InputSystem.InputActionAsset.FindAction (System.String actionNameOrId, System.Boolean throwIfNotFound) (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Actions/InputActionAsset.cs:549)
    UnityEngine.InputSystem.Editor.PlayerInputEditor.OnActionAssetChange () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs:443)
    UnityEngine.InputSystem.Editor.PlayerInputEditor.OnInspectorGUI () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs:77)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass62_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <ebb02a01ca6f421580a8e2b277849760>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
    Aborting
    UnityEngine.GUILayoutGroup.GetNext () (at <f565f35f275d40b88c20b618c59644e4>:0)
    UnityEngine.GUILayoutUtility.DoGetRect (System.Single minWidth, System.Single maxWidth, System.Single minHeight, System.Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <f565f35f275d40b88c20b618c59644e4>:0)
    UnityEngine.GUILayoutUtility.GetRect (System.Single minWidth, System.Single maxWidth, System.Single minHeight, System.Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <f565f35f275d40b88c20b618c59644e4>:0)
    UnityEditor.EditorGUILayout.GetControlRect (System.Boolean hasLabel, System.Single height, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <a01bf2e497e84ae285aeb97a3052e6cc>:0)
    UnityEditor.EditorGUILayout.GetControlRect (System.Boolean hasLabel, System.Single height, UnityEngine.GUILayoutOption[] options) (at <a01bf2e497e84ae285aeb97a3052e6cc>:0)
    UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <a01bf2e497e84ae285aeb97a3052e6cc>:0)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <a01bf2e497e84ae285aeb97a3052e6cc>:0)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, UnityEngine.GUILayoutOption[] options) (at <a01bf2e497e84ae285aeb97a3052e6cc>:0)
    UnityEngine.InputSystem.Editor.PlayerInputEditor.OnInspectorGUI () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs:138)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass62_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <ebb02a01ca6f421580a8e2b277849760>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  2. Q-Ted

    Q-Ted

    Joined:
    Dec 16, 2016
    Posts:
    46
    I did some additional testing and the issue only appears after you set the enabled flag to true on the PlayerInput to true. Regardless of whether or not the component is already enabled or not.