Search Unity

Null Reference while resolving binding: Submit

Discussion in 'Input System' started by bconstantin, Jun 21, 2022.

  1. bconstantin

    bconstantin

    Joined:
    Feb 4, 2019
    Posts:
    15
    Hi,

    I have an error when creating a totally new virtual Input device. All is setup according to documentation and it throw this error:

    NullReferenceException while resolving binding 'Submit:*/(Submit)' in action map 'DefaultInputActions (UnityEngine.InputSystem.InputActionAsset):UI'
    UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    OSG.OSGLogHandler:DisplayLogInConsole (OSG.OSGLogHandler/OSGLog&) (at Library/PackageCache/com.osg.debug@0.1.42/Runtime/Logger/OSGLogHandler.cs:199)
    OSG.OSGLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) (at Library/PackageCache/com.osg.debug@0.1.42/Runtime/Logger/OSGLogHandler.cs:184)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1/<>c__DisplayClass57_0<UnityEngine.GameObject>:<add_CompletedTypeless>b__0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>)
    DelegateList`1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>) (at Library/PackageCache/com.unity.addressables@1.20.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.Util.DelayedActionManager:LateUpdate () (at Library/PackageCache/com.unity.addressables@1.20.0/Runtime/ResourceManager/Util/DelayedActionManager.cs:156)

    If I inherite from GamePad I don't have this one, but instead a "FLT State mut be byte-aligned"

    The controller:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2. [InitializeOnLoad]
    3. #endif
    4. [InputControlLayout(stateType = typeof(VirtualHIDInputReport))]
    5. public class VirtualController: InputDevice
    6. {
    7.     public AxisControl circular { get; private set; }
    8.  
    9.     public Vector2Control leftStick { get; private set; }
    10.     public Vector2Control rightStick { get; private set; }
    11.  
    12.     static VirtualController()
    13.     {
    14.         InputSystem.RegisterLayout<VirtualController>();
    15.     }
    16.  
    17.     // You still need a way to trigger execution of the static constructor
    18.     // in the Player. To do this, you can add the RuntimeInitializeOnLoadMethod
    19.     // to an empty method.
    20.     [RuntimeInitializeOnLoadMethod]
    21.     private static void InitializeInPlayer() { }
    22.  
    23.  
    24.     protected override void FinishSetup()
    25.     {
    26.         base.FinishSetup();
    27.  
    28.         circular = GetChildControl<AxisControl>("circular");
    29.         leftStick = GetChildControl<Vector2Control>("leftStick");
    30.         rightStick = GetChildControl<Vector2Control>("rightStick");
    31.     }
    32. }
    33.  
    34.  
    35.  
    36. struct VirtualHIDInputReport : IInputStateTypeInfo
    37. {    public FourCC format => new FourCC('I', 'N', 'P', 'T');
    38.  
    39.     //Inputcontrol for swipe directions
    40.     [InputControl(name = "swipeUp", layout = "Button",  displayName = "Swipe Up")]
    41.     [InputControl(name = "swipeDown", layout = "Button",  displayName = "Swipe Down")]
    42.     [InputControl(name = "swipeLeft", layout = "Button",  displayName = "Swipe Left")]
    43.     [InputControl(name = "swipeRight", layout = "Button",  displayName = "Swipe Right")]
    44.  
    45.     [InputControl(name = "hold", layout = "Button",  displayName = "Hold")]
    46.     [InputControl(name = "releaseHold", layout = "Button",  displayName = "Release Hold")]
    47.  
    48.     [InputControl(name = "tap", layout = "Button", displayName = "Tap")]
    49.     [InputControl(name = "Submit [Any] {GLOBAL}", layout = "Button", displayName = "Submit")]
    50.     [InputControl(name = "Cancel", layout = "Button", displayName = "Cancel")]
    51.     public ushort buttons;
    52.  
    53.  
    54.     [InputControl(name = "circular", layout = "Axis",  displayName = "Circular")]
    55.     public byte axis;
    56.  
    57.     [InputControl(name = "leftStick", layout = "Vector2", displayName = "Left Stick")]
    58.      public Vector2 leftStick;
    59.  
    60.     [InputControl(name = "rightStick", layout = "Vector2", displayName = "Right Stick")]
    61.      public Vector2 rightStick;
    62. }
    Any help with this ? :)
     
    Last edited: Jun 21, 2022