Game skips input on 9999 fps but doesn't on 60 fps?

Hello!
I have a simple scene where the code kinda depends on Time.deltaTime.
I tried to build the scene with frameratelimit on 9999 fps and on 60 fps, when on 60 fps it work quite right, but on 9999 fps it got extremely bad with the input.

I have no abnormalities in my code, just normal use of Time.deltaTime, so I don’t know what the problem is.

I have also tried not limiting the frame rate, in which case it got really high and caused the same problem as with 9999 fps.

A CharacterController's physics are processed during FixedUpdate().

With that in mind, you’re currently reliant on lucky timing based on the way you’re processing those physics.

So, let’s start with how you’re handling Jumping in the first place:

if (Input.GetButtonDown("Jump") && canCrouchUp)
{
	Jumping();
}
else
{
	gravityVector.y = gravityForce;
}

// ... and...

void Jumping()
{
// ...
	gravityVector.y = jumpForceMultiplier;
}

First, let’s compare Update() to FixedUpdate(). Update() runs as rapidly as possible/is permitted (i.e. limited by Vertical Sync), where FixedUpdate() only runs at a fixed pace (by default, 50 times per second).

Based on your script, this means that it’s a race. After the Update() cycle where you provide input, will FixedUpdate() take place and process the instructions given to the CharacterController, or will the next Update() run and reset “gravityVector.y” to the “gravityForce” value again?

With a lower framerate (60, for instance), Update() can run twice in a row without a FixedUpdate(), but it’s a 1/6 chance to occur. By contrast, with a framerate of 500, you would have only a 1/10 chance of your “Jumping()” function’s impact on gravityVector being reflected by the physics interactions.

(As another element of this…

isGrounded = Physics.CheckSphere(transform.position - new Vector3(0f, 0.56f, 0f), 0.5f, groundedLayers); //CheckSphere to know when player is and isn't Grounded.

… would be run again before you have a chance to move, resulting in the assumption you’re on the ground and, therefore, negating the change to “gravityVector”)

Finally, in addition to all this, you’re mixing up your [position-by-gravity] and [acceleration-by-gravity] formulas, resulting in a somewhat irregular gravitational formula:

// After 1 second, vertical speed would be (gravityForce^2)
// After 2 seconds, vertical speed would be (2 * gravityForce^2)
// After 3 seconds, vertical speed would be (3 * gravityForce^2)
// And so on...
gravityVector.y -= gravityForce * gravityForce * Time.deltaTime;

// After 1 second, vertical speed would be (gravityForce)
// After 2 seconds, vertical speed would be (2 * gravityForce)
// After 3 seconds, vertical speed would be (3 * gravityForce)
// And so on...
gravityVector.y -= gravityForce * Time.deltaTime;