This is my code for what my title says, I can do double jump once on start but then I can’t once I land, I’m new to coding:
public float doubleJump = 0f;
public Transform groundcheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;
Vector3 velocity;
bool isGrounded;
void Update()
{
isGrounded = Physics.CheckSphere(groundcheck.position, groundDistance, groundMask);
if(isGrounded && velocity.y < 0)
{
velocity.y = -2f;
}
if(doubleJump > 0 && isGrounded)
{
doubleJump = 0f;
}