New Input System context performed doesn't seem to be "holding" the key?

Hi! I just started migrating from the Old Input System to the new one and I’m going crazy with this… Basically, I wanna do a variable jump height system (the more you hold the jump button, the higher the jump goes). I tried looking at the documentation, tried watching tutorials but I can’t figure out this part for NOTHING.

This is the current code (sorry for the mess)

public void Jump(InputAction.CallbackContext context)
   {

     
        if(isGrounded() )
        {

             if (context.started)
             {
             Debug.Log("started!");
             isJumping = true;
             _canJump = false;
             jumpTimeCounter = jumpTime;
             _rb.linearVelocity = new Vector3(_rb.linearVelocity.x, jumpForce, _rb.linearVelocity.z);

             
            }
          
            
        }

         if(context.performed )
        {
            Debug.Log("performed!");
            if(jumpTimeCounter > 0)
            {
             _canJump = false;
                 
             _rb.linearVelocity = new Vector3(_rb.linearVelocity.x, jumpForce, _rb.linearVelocity.z);
             
             
            }
            else
            {
            isJumping = false;
            }
         }


        if(context.canceled)
        {
         isJumping = false;      
         }

I also added some Debug Logs to the context started and performed and I noticed both of em only log for 1 frame, which seems to make sense for context.started but I thought context.performed should log until I stop holding the jump key? Anyway, I’m pretty confused and would love if someone could hold my hand and solve it to me so I can understand what to do.
Thanks in advance!

For this kind of stuff I’ve always still polled on a per-frame basis.

You can still use callbacks for the initial jump, but will then need to evaluate whether the particular action is pressed (such as with InputAction.IsPressed()) to continue the variable jump.

Not sure what workflow you’re going with, but I find it easiest to work with individual InputActionReference assets that you just reference via the inspector.

Can you elaborate? You mean I should create another action for when holding the same button? Sorry haha, this new input system is kicking my ass

No, just the same action, and poll the action’s .IsPressed() on a per-frame basis in Update as you might normally do.

For example:

public class JumpInputExample : MonoBehaviour
{
    [SerializeField]
    private InputActionReference _jumpInputReference;
    
    private bool _isJumping = false;
    
    private void Awake()
    {
        _jumpInputReference.action.performed += HandleOnJump;
    }
    
    private void OnDestroy()
    {
        _jumpInputReference.action.performed -= HandleOnJump;
    }
    
    private void Update()
    {
        if (_isJumping == true)
        {
            HandleHoldJump();
        }
    }
    
    private void HandleOnJump(InputAction.CallbackContext ctx)
    {
        StartJump();
    }
    
    private void StartJump()
    {
        // check can jump
        // jump player
        _isJumping = true;
    }
    
    private void HandleHoldJump()
    {
        bool jumpIsPressed = _jumpInputReference.action.IsPressed();
        if (jumpIsPressed == false)
        {
            _isJumping = false;
            return;
        }
        
        // more jumping
    }
}