Double Jump in Unity
Give another jump to the player.
Objective: allow the player to jump twice before touching the floor again.
We have ready the player jump, but now we want to give the player the chance to jump again before touching the floor.
In the player script I created a new bool variable called _doubleJump, then in the update method when we check if the player is grounded, if it is true we set the value of the bool to true and if it is false we check for the space key and if the _doubleJumpp variable is true, in that case we add the jump height to the vector and set the value of _doubleJump to false to avoid to jump again.
And that’s it!!!! Now the player can jump twice.