void Jump(){
bool isGrounded = myCol.IsTouchingLayers(LayerMask.GetMask("Ground"));
if(!jumped && Input.GetKeyDown("space") && isGrounded){
myRigidbody.AddForce(new Vector2(0,jumpForce*100));
jumped = true;
}
if (isGrounded){
myAnimator.SetBool("isJumping",false);
}
else if (!isGrounded && jumped){
myAnimator.SetBool("isJumping",true);
jumped = false;
}
}
Because, if im correct, OnJump would only be called when i press spacebar so it wont be able to know when the player touches the ground again