Problem with new Input System Error when using interaction

Hello All.
I am trying to fight the problem for two days but until now I was unable to find a solution.
Here is the error which I am getting:

I am using new Input System. I have made all the steps according to the official guide.
Here is my setup

And here is my code:

using UnityEngine;
using UnityEngine.InputSystem;

public class Movement : MonoBehaviour, Loco.IPlayerActions
{

    InputAction pickup;
    Loco controls;

    private void OnEnable()
    {
        if (controls == null)
        {
            controls = new Loco();
            controls.Player.SetCallbacks(this);

        }
        controls.Player.Enable();
        pickup = controls.Player.PickUp;

        pickup.started += _ => { Debug.Log("Started"); };
        pickup.performed += _ => { Debug.Log("Performed"); };

    }

    public void OnMove(InputAction.CallbackContext context)
    {
      
    }

    public void OnPickUp(InputAction.CallbackContext context)
    {
       
    }
    private void OnDisable()
    {
        controls.Player.Disable(); 
    }
}

Error appears only if I hold a button longer than given Hold time. Does anyone has any idea what is wrong?

Try removing or renaming your OnMove() and/or OnPickup() functions to something else. I had the same problem when trying to add functions named OnMove() and OnFire() to the “performed” InputActions for Move and Fire. Simply renaming them to OnMoveX() and OnFireX() had everything working as expected, although I don’t know the reason for this.

Maybe someone else can give an explanation?

From my trial and error, I believe the parameter should be

  • CallbackContext when the Player Input’s Behavior is set to “Invoke Unity Events”
  • InputValue when the behavior is “Broadcast/Send Messages”.

Give this a try:

public void OnPickUp(InputValue value)
{
        
}

Did you ever find the solution to this? I’m having the same issue.