Why is my rigidbody jump height different every time, despite being in FixedUpdate.

void FixedUpdate()
{
Jump(jumpForce);
}

    public void Jump(float jumpHeight)
    {
        if (isGrounded() && Input.GetButtonDown("Jump") && rB.velocity.y == 0)
        {
            rB.velocity = new Vector3(rB.velocity.x, 0, rB.velocity.z);
            rB.AddForce(new Vector3(0, jumpHeight, 0), ForceMode.VelocityChange);
        }
    }

Here is my script.

For some reason the height my player character reaches is slightly different every time. Additionally, the player characters jump height is very different while in editor fullscreen. In editor he achieves a height of 6 on the y axis while not full screened. Full screen he only achieves a height of 3.

If I had to guess I’d assume it’s because of the way I’m calling Jump(), but I want to make sure.

Thank you!

I’ve tested your code and it’s good.
He always jumped at the same height.
Check the number 20 instead of “jumpHeight” and check the height.
Maybe it gets bad value.