Unity is not reading the whole code.

I have a worse case scenario where Unity does not read the if statement, this solely happens but this bug is very game breaking. For some reason it doesnt read when I do a very fast clicks “if(timer < .9f)” therefore it does not call the method ComparePos();

        if (Input.GetMouseButton(0) && player_rb.velocity.y == 0 && enableInput) {
            angle += (5f * Time.deltaTime) + .6f;
            velocity += (2.1f * Time.deltaTime) + .1f;
            path.tvelocity = velocity;
            path.tangle = angle;
            onGround = true;
            timer += Time.deltaTime;
            if (velocity >= velocityThreshold)
            {
                Jump();
                enableInput = false;
                angle = 0;      
                velocity = 0;
            }
        }
        else
        {
            if (Input.GetMouseButtonUp(0) && enableInput) {
                if (debugEnable){
                    Debug.Log("Angle: " + path.tangle + " Velocity: "+path.tvelocity);
                }
                Jump();
                enableInput = false;
                Debug.Log("Enable: " + enableInput);

                if (timer < .9f) {
                    Debug.Log("Timer: "+timer);
                    cameraFollow.ComparePos();
                }
            }
        }

This conditional statements are under the Update() function. I would like to know what are the ways to prevent this from happening or simply how to fix these kinds of problem.

Wrong

Right123006-right.png

Not sure why you choose Time.deltaTime over Time.TimeSinceLevelLoad - would be my first change, my second, is not comparing it to a set value. - Also can’t really see a reason to nest the if (mouseup) part - would separate those two into their own independent if statements – lastly – you change velocity in the first conditional – path.tvelocity = velocity; — perhaps it triggers if (velocity >= velocityThreshold) - to set enableInput = false; - making it impossible to reach the if (mouseup && enableInput)

if (Input.GetMouseButton(0) && player_rb.velocity.y == 0 && enableInput) 
{
    if (timerSet == False)
    { timerSet = true; timer = Time.TimeSinceLevelLoad; }
}

if (Input.GetMouseButtonUp(0) && enableInput) 
{
    if (timer + delay <= Time.TimeSinceLevelLoad) 
    { // Do Stuff then init timerSet = false }
}