Create a new guiWindow every time button is clicked?

Hi, I have an editor window with a button.
How do I make it so that every time the button is pressed a new guiWindow pops up?

So far I tried:

if(GUILayout.Button("Add Window", GUILayout.Width(150), GUILayout.Height(50))){
   windowsOpen++;
   showWindows = true;
}

then I have:

if(showWindows){
       		windowRect = GUILayout.Window (windowsOpen, windowRect, EntryWindow, "Window "+windowsOpen.ToString());
        }

I didn’t really expect this to work and it didn’t. The results are, when I click the button the first time a window pops up and any additional time the title just increments but no *New window comes up. Any ideas on how to duplicate guiWindows on button click?

Just call GUI.Window as many times as you have windows…
Easy way: Have a list of Rect’s and for every Rect in that list, set that Rect to a window with that Rect (As your doing right now)
var Rects:Array;
private var rct:Rect;

funtion OnGUI() {
    if (GUILayout.Button("Add window")) {
        Rects.Add(Rect(defaultRect));
    }
    
    for (rct in Rects) {
        rct = GUILayout.Window(/*windowinfo*/, rct);
    }
}

This does mean, that your windows will not be individualised, but just a copy of each other, for individualisation, you need to use class objects, in much the same way as I used Rects

Benproductions1