Adding different features to different GUI Windows...

I currently have 2 GUI Windows. I want to make one have a label and the other have a button.

Here is the script I'm using:(found off a tutorial)

var windowRect0 = Rect (20, 20, 120, 50);

var windowRect1 = Rect (20, 100, 120, 50);

function OnGUI () {

// Register the window. We create two windows that use the same function

// Notice that their IDs differ

windowRect0 = GUI.Window (0, windowRect0, DoMyWindow, "My Window");

windowRect1 = GUI.Window (1, windowRect1, DoMyWindow, "My Window");


// Make the contents of the window

function DoMyWindow (windowID : int) {

if (GUI.Button (Rect (10,20,100,20), "Hello World"))

print ("Got a click in window " + windowID);

// Make the windows be draggable.

GUI.DragWindow (Rect (0,0,10000,10000));


I don't really understand how to make a different window take a different part....

So how could I make my windowRect0 get the button and the windowRect1 get a label???

You'd either make two seperate DoMyWindow functions (So you'd call one from each Window function), or use a switch/if in the DoMyWindow function which decides what stuff to draw inside it

Edit (using the id to change behaviour):

in your DoMyWindow function:

    case 0:  //these case values would be better as defined variables so they can be changed
        //do something

    case 1:
        //do something