Frustrated with learning the input system

EDIT/UPDATE: Okay, figured it out. I was camelcasing the onEnable, (supposed to be OnEnable)

I have scoured the official documentation, watched dozens of youtubers as well as the unity lecture on the new input system and I still cannot get this input system to work in the most basic capacity…

I can’t get the Player Input component to send GameObject.SendMessages() calls on all my player action methods. My onWhatever methods just won’t trigger from these at all… no errors in console, no warnings… it just won’t trigger any of them even though these methods are listed in the box beneath the dropdown selector in the inspector (onWalk, onLook, onJump, etc). They just. aren’t. triggering. like the official documentation says they should here: GameObject components for input | Input System | 1.0.2

So I moved on to sending Unity Events instead (started, performed, canceled etc) using callbacks, and no matter what I do, nothing will compile because I get an error no matter what I change or how I much i hack around with the order of things. Not gonna lie… I’m definitely spoiled by how well chrome and firefox dev tools consoles log errors. This console is… well… bad. I’ve been crawling further and further down rabbit holes that are so far abstracted from what I’m trying to do that I’ve wasted two days on this by now, just by trying to debug using the vague console error feedback. Whokay I’m ranting here is my code right now:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class playerMove : MonoBehaviour
{
    public InputControl Actions;
    void Awake()
    {
        Actions = new InputControl();
        Actions.Player.Move.performed += Move;
    }

    void onEnable()
    {
        Actions.Enable();
    }

    void onDisable()
    {
        Actions.Disable();
    }

    void Move()
    {
        print("HEY");
    }

    void Update()
    {
    }
}

This gives me: Assets\Controllers\Player\playerMove.cs(12,9): error CS0123: No overload for ‘Move’ matches delegate ‘Action<InputAction.CallbackContext>’

Which is related to the callback or its syntax or something… something that I’ve never seen anyone in these videos or in documentation mention, even when using something in exactly this syntax, ie. Brackeys has a video doing this. The official documentation examples appear to use this methodology, though I can’t be sure because they are just vague snippets with no real context. (ugh, just longing for some MDN-tier documentation here, my firefox privilege is showing lmao)

I’ve tried bypassing this and using polling with isTriggered as per official docs, and then I get a different error about not having InputAction.CallbackContext, so I’m thinking, okay, I’ll just add the argument to the params in function declaration, and whamo, now I get another error because when I call the function I don’t have the actual parameter in function call in Update(). Nobody anywhere that I can find an example of is using the polling method, and I’ve mirrored just about every tutorial or doc example I’ve seen.

Just to be sure I’ve covered my bases, so far I do things in (generally) this order:

  • Import input system and auto restart via package manager

  • Create the player action asset using the menu and program my player action map to actions bound with keys and/or vector2 axis (for wasd)

  • Save asset, generate C# class

  • Create Player Input component, link asset

  • Create player movement script, drag it to player object

  • Edit player movement script, referencing generated C# class

My brain is telling me to scrap the entire player action asset business as well as the player input component and just go straight to intercepting the events in C#, but if I’m gonna be circumventing everything I might as well switch to unreal at that point so I’m hoping someone here can steer me in the right direction.

Here is an adaptation. When using the lambda expression and storing the data in a one liner, the error from above goes away, however, the following still doesn’t work and fails silently.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class playerMove : MonoBehaviour
{
    public InputControl Actions;
    private Vector2 moveInput;
    private Vector3 targetInput;
    [SerializeField]
    private float speed = 4f;


    void Awake()
    {
        Actions = new InputControl();
        Actions.Player.Move.performed += ctx => moveInput = ctx.ReadValue<Vector2>();
    }

    void onEnable()
    {
        Actions.Player.Enable();
    }

    void onDisable()
    {
        Actions.Player.Disable();
    }

    void Move() //obsolete
    {
        print("HEY");
    }

    void FixedUpdate()
    {
        targetInput = new Vector3 (moveInput.x, 0, moveInput.y);
        transform.position += targetInput * speed * Time.deltaTime;
    }
}

The other problem I have with this aside from it just not working, is that I don’t want to cram logic into one liners. I’d really like the added modularity of having a separate callback function just in case I need to implement more operations/logic.

output of print(Actions.Player.Move) shows that it seems to be referencing the keys properly:

Input debugger also shows the proper STAT/TEXT events when keying, so

-keyboard input is being received by unity
-and the action map is logging correct keys to console, so it is properly referenced
-and the code is not throwing any errors

…this makes me believe that something is wrong with my setup, but I just don’t understand what it could be.

-I imported the Input System properly, otherwise I’d get errors, right?
-My player settings has it set to Input System (new) not the old one or “both”
-I have the player movement script on my player (a capsule)
-I have the Player Input component set to send Unity Events
-I have my Input Action Asset linked to this Player Input component

… I just. don’t. get. it.

Been having the same issues. Aparrently this does not work in 2019.4.w/e. try downgrading to 2019.3 and see if that works. I have an older game that I created for the purposes of testing the Input system, and it used to work back then. I recently updated it and the inputs simply stopped working.

@djwaver
How can you use void Move() as an action for Actions.Player.Move.performed that needs an action with parameter.
I don’t even read documentation for this. This is clearly seen by the lambda you are using.