If using a conditional-situational menu, such as a pop-up, must wait till next OnGUI?

If you are using a conditional-situational menu... such as a pop-up dialog ("Are you sure you want to quit", etc) that occurs after you click on another gui button ("Quit"), is the only way to create both the toggle-button gui menu and check the conditional to wait until the next `OnGUI`-call?

In this case, every time you have a dialog like this, you would have to use a global to check for loading the dialog on next onGUI?

After clicking the GUI Button "Quit" you could instantiate an empty game object prefab with an attached OnGUI script for the pop-up confirmation. This way you could simply instantiate and destroy the situational code without having it embedded in the overall global call.

You could just use boolean vars to toggle what GUI code you want to show, like this:

private var showQuit : boolean = false;

function OnGUI(){

    if (GUI.Button (Rect (10,10, 100, 50), "Quit Game")) {
        showQuit = true;
    }

    if (showQuit == true){
        GUI.Button(Rect ((Screen.width/2), (Screen.height/2), 100, 50), "Are you sure you want to quit?");
    }

}