I use this code for jumping. Actually, it seems to work fine. However, whenever my cube is completely standing still on the ground, the game neither sends me the log message nor jumps when I press space. Whenever I start to move, everything works fine, I can jump.
void OnCollisionStay(Collision collisionInfo)
{
if (collisionInfo.collider.tag == "Ground")
{
Debug.Log("We are grounded at the monment");
if (Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.Joystick1Button1))
{
rb.AddForce(0, jumpForce * Time.deltaTime, 0, ForceMode.VelocityChange);
}
}
}
}