GUI: Windows inside Windows

Is it possible to have a window generated by pressing a button (from a set of buttons which produces only one window at a time) inside a generated window?

I can’t find a way to get this to work. Sometimes some of the buttons create a window, while other times they just don’t work.

I have created a unity package with a minimalistic test scene where this problem occurs. You can download it here:

http://feupload.fe.up.pt/get/MhGJhplt45EjkFP

EDIT - Example 2: I have just reduced this to the simplest case possible, a window inside a window. This correctly renders both of the windows, but it still shows a runtime error on the console. I suppose Unity can’t handle Windows inside Windows.

using UnityEngine;

public class Test : MonoBehaviour {

void OnGUI() {
    GUILayout.Window(0, new Rect(0, 0, 200, 300), OnGUIWindow, "Parent");
}

void OnGUIWindow(int windowID) {
    GUILayout.Label("Parent");
    GUILayout.Window(1, new Rect(0, 0, 100, 150), drawWindow, "Son"); 	
}

void drawWindow(int windowID) {
    GUILayout.Label("Son");
}

}

Errors:

InvalidOperationException: Hashtable.Enumerator: snapshot out of sync.

ArgumentException: Getting control 0’s position in a group with only 0 controls when doing Repaint

When I decided to make a drop-down control I chose to make a popup manager which is a MonoBehaviour of its own and is in charge of rendering any popup window that is open. Thanks to “GUI.BringWindowToFront” it can keep the popups above the window onto which the drop-down control is placed.

So basically I have a TextField and a Button. When the button is pressed it registers a popup to be opened below the TextField. This way the window can overlap anything defined below in the layout and also get out of the main window bounds.

I’ve made a few videos already. It works pretty well I think.