Upgraded my project to the new Unity Input system and I’m having a lot of trouble adopting it.
public void GetJumpInput(InputAction.CallbackContext context)
{
if (context.action.triggered && Player.isGrounded)
{
isJumping = true;
}
if (context.action.triggered && !Player.isGrounded && extraJumps == 1)
{
isJumping = true;
extraJumps--;
}
}
private void FixedUpdate()
{
if (isJumping == true)
{
p_rb.velocity = Vector2.up * initialJumpVelocity;
isJumping = false;
}
}
This is the closest I could get for my jump to work as I would want. A lot of other things I tried made the player keep jumping for as long as the key is being held down.
What would be the best way for set up some kind of variable for the button to be called when pressed and then a ‘negative’ call when released (preferably without having to put all that code within that void function)(is that even possible with the Input System?)