Use a function the next time a bool is true?

So basically I want my game to work where the player can charge up a jump and the next time he is on the ground it will jump him.

So you long press to charge a jump, but right now my jump function is run through a if(grounded == true) statement, it can be difficult for the player to release the jump button the frame that the player is grounded so is there a way to script the next time he contacts the ground?

I thought about having a box collider trigger that hangs below the player and if that’s colliding with ground it will allow the jump to add some forgiveness, but then the player kinda jumps mid air which is a little weird. I could make it smaller but that sort of defeats the purpose I dunno…


You could do something in a way that whenever you release the jump button it will set a boolean to true and then you could have an statement like:

if (ground == true && jumpReleased == true) {
    rb.velocity = new Vector2(rb.velocity.x, jumpForce);