OnGUI Button doesn't execute until I release the button

I have this inside my OnGUI function

if (GUI.Button (Rect (side, height, side, height), “”, jumpbutton)) {


and then I have an update function which moves a character controller and if jump is set to true the character controller jumps. The GUI button doesn’t send the jump = true message until the button is released is their anyway to send this signal as soon as the button is pressed? I’ve tried messing around with the GUI.RepeatButton and tried to just detect the first instance of setting jump to true and then ignoring the rest but it’s gonna be a bit of a hassle to redo my code.

Is there a better way to immediately detect the button press?

Write this in Update method

if ( Input.GetMouseButtonDown( 0 ) ) {
    jump = true;

You will need to detect if the click position is correct in order to jump. If not, every screen click will make the object (or whatever) jump.