Grounded and pressing "jump" not working?

I’m trying to make my character jump. I want to do this by checking that the character controller is grounded, and that the jump button has been pressed. Individually, these work correctly if(controller.isGrounded) and if(Jump button pressed)), but together they don’t.` Why not? If they are both true on their own, why aren’t they true one after the other?

EDIT: I’ve figured out what the main problem was: it was the fact that my character wasn’t moving along his yVelocity at all so I guess it couldn’t tell if it was grounded. However a new problem has arisen. Even when the method itself is invoked (that is, when the jump button is pressed and the character is on the ground) the Y Velocity doesn’t change. So the method is called but for some reason it won’t make the character jump? I’d say it’s about 60% of the time the character jumps and 40% it just ignores it.

In my experience with the CC, it has poor ground detection. The best way I can put it is that it “flickers” true/false very quickly. Without seeing more code and understanding exactly how everything works, I would say that you might need to set a vertical velocity when grounded (something small like Time.deltaTime has worked fine in my experiments), and calling CC.Move () to apply said velocity. I hope that helps, again it’s hard to address the question without seeing application.