Double Jump Prevention system not working

       if (UpAction.IsPressed() && isOnGround)
        {
            playerRb.AddForce(Vector3.up * JumpForce, ForceMode2D.Impulse);
            isOnGround = false;
        }

this is my code to make my character jump, with isOnGround checking to see if they are in a position to jump.

My problem is when I use this code, it sets isOnGround to false, but doesn’t jump because isOnGround is false. Is there anyway to stagger it so the jump happens before the game flags isOnGround to false?

thank you.

If you want an example of a double-jump (or really 1-, 2-, 3-, whatever-X-Jump system), here’s mine:

proximity_buttons is presently hosted at these locations:

https://bitbucket.org/kurtdekker/proximity_buttons

Otherwise if you’re struggling with what you have, that means it is time to start debugging!

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.