Search Unity

Bug Custom InputProcessor not appearing in the Input Actions window

Discussion in 'Input System' started by nratcliff, Jan 24, 2023.

  1. nratcliff

    nratcliff

    Joined:
    Jul 5, 2014
    Posts:
    66
    I have followed the docs here to create a custom input processor:

    Code (CSharp):
    1. #if UNITY_EDITOR
    2. [InitializeOnLoad]
    3. #endif
    4. public class ValueRampProcessor : InputProcessor<Vector2>
    5. {
    6.     #if UNITY_EDITOR
    7.     static ValueRampProcessor()
    8.     {
    9.         Init();
    10.     }
    11.     #endif
    12.                                                                        
    13.     [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    14.     private static void Init()
    15.     {
    16.         InputSystem.RegisterProcessor<ValueRampProcessor>();
    17.     }
    18.  
    19.     public AnimationCurve XCurve = AnimationCurve.Linear(0, 0, 1, 1);
    20.     public AnimationCurve YCurve = AnimationCurve.Linear(0, 0, 1, 1);
    21.  
    22.     public override Vector2 Process(Vector2 value, InputControl control)
    23.     {
    24.         return new Vector2(XCurve.Evaluate(value.X), YCurve.Evaluate(value.Y));
    25.     }
    26. }
    However, the processor does not appear in the menu as I would expect.

    upload_2023-1-24_13-55-38.png

    What's going on here? I'm using Unity 2021.3.16f1 and Input System 1.4.4 on macOS 13.2 (Intel).
     
  2. nratcliff

    nratcliff

    Joined:
    Jul 5, 2014
    Posts:
    66
    Hah, of course after I write up the forum post I notice that my IDE inserted
    using Vector2 = System.Numerics.Vector2;
    ✨automagically✨. Fixing the type reference fixed it.