GUI Message Box Handling

With the unity GUI I have created a message box via BeginGroup etc.

But Im wondering what is the best way for this to capture all the input so that no other controls can be used until this messagebox has been handled?

So that the game (all other GUI controls) essentially waits for a response in this message box.


Just turn off all the other GUI controls so the message box is the only one shown. There is currently no way to make a part of a GUI Modal.

Something like this:

bool MessageBox = false;

void OnGUI()
          // Message Box GUI Code
          // Regular GUI Code

hi everyone! Greetings from Lisbon!

Talking about MessageBoxes a doubt came up:

is there any way to have something like this bilt on a webplayer?

if (UnityEditor.EditorUtility.DisplayDialog(title, body, "Yes", "No"))
    print ("Yes");    
    print ("No");

I mean: is there any easy way to do it without having to draw GUI.Box, GUI.TextArea and GUI.Buttons and use a boolean to let you know the dialog is still open?

Thank you all

Edit: I'm going to open a new post with this question (20-04-2011)

Normally you could use a box big enough to fill the screen and then show your message box. However, this doesn't work because the unity GUI has a nasty bug that allows gui elements that are behind other gui elements to still receive user input like clicks or mouse hovers.

Because of this behaviour it is probably the best and definitely the easiest solution to use a variable isModalDialogShowing: boolean that is visible from all scripts. If you want to show a modal dialog like your message box, set it to true and don't handle any other user input or show gui elements unless isModalDialogShowing is false.