What is the jump buffer supposed to do? From what I can see here, itās not going to do anything. It will be set as soon as the player presses space and - provided maxJumpBuffer is greater than Time.deltaTime - it will do the jump and be reset again. It may as well have been a boolean.
But you say you get the ājumpedā message, which means it was meant to jump but it didnāt. What is jumpForce set to?
The jump buffer is there so that even if the player presses the jump a few miliseconds before touching the ground it registers it and jumps WHEN it touches the ground.
Hereās how its supposed to work
Suppose the character is in the air and is about to the touch the ground in just 0.5 seconds. Now assume the player presses the jump button. Let the maxJumpBuffer be say 1 sec. So when the player presses the jump button, the jumpBuffer sets to 1 and since the player was about to the touch the ground in 0.5 sec, when it touches the ground the jumpBuffer will be (maxJumpBuffer-0.5) ie >0.
And when he touches the ground, the coyoteTimer will also be set to >0. And since both the conditions are met he should jump.
Yes the jumped message is seen. And the jumpForce is high enough. Plus the player jumps perfectly when he is on the ground.
I believe the problem is that you have velocity of the character falling (at the end of the jump) that needs to be overcome by the new jump force. Itās not enough. You may need to completely remove the current velocity before adding the new jump velocity.
But this is not the right way to do it. You want the physics to handle velocity changes. So, perhaps grab the current y-value from velocity and add it to the jump force. It will be downwards (negative) so youād need to invert it