GUI appears even if bool is false

Hi everyone. I have a little problem because my GUI suddenly appears even if the bool controlling it is false…

This is the code:

void OnGUI()
    {
        GUI.skin = Counter;
        if (!gameOver)
        {
            GUI.Label(new Rect(0, 0, 100, 60), "Score : " + points);
            GUI.Label(new Rect(Screen.width - 90, 0, 90, 60), "Level: " + current);
            if (timeTrial)
            {
                GUI.Label(new Rect(Screen.width / 2 - 50, 0, 100, 30), timeLeft.ToString());
            }
        }
        else if (gameOver)
        {
            GUI.skin = BG;

            GUI.Box(new Rect(Screen.width / 2 - 160, Screen.height / 2 - 160, 320, 220), "Game Over");

            GUI.skin = Menu;
            if (GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 130, 300, 90), "TRY AGAIN"))
            {
                blockCount = 0;
                current = 0;
                points = 0;

                if (timeTrial)
                {
                    timePassed = 0;
                    timeLeft = maxTime;
                }

                gameOver = false;
                Time.timeScale = 1.0f;

                if (Application.loadedLevel == 1)
                {
                    Application.LoadLevel(1);
                }
                else Application.LoadLevel(2);
                Debug.Log(gameOver + " " + Application.loadedLevel);
            }
            if (GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 40, 300, 90), "BACK"))
            {
                Application.LoadLevel(0);
            }
        }

As you can see there is a debug command and the gui shows up even if gameOver = false.

Does anyone know why?

You are setting gameOver to be false in line 32, so it will always be false in line 40 when you debug. But it doesn’t mean that it was originally false when the if was tested in line 4.