Can you Help me with GUI button toggling?

How can I make the Gui.Toggle to a Gui.Button?

Can you Help me?

Code:

var showWindow: boolean = true;
function OnGUI () {
    showWindow = GUI.Toggle (Rect (16, 16, 128, 24), showWindow, "Show My Window");
    if (showWindow) {
        GUI.Window (0, Rect (128, 64, 256, 128), MyWindow, "My Window");
    }
}

function MyWindow (windowID : int) {
    GUI.Label(Rect (64, 32, 128, 24), "Hello, world!");
    if (GUI.Button (Rect (64, 64, 128, 24), "Close")) {
        showWindow = false;
    }
}

Thanks

This is done by overiding the default styling of the GUI by declaring a new style at the end, eg. "..., "button");".

For example!

    var toggleButton : boolean;

    function OnGUI () {
//style toggle as a button!    
toggleButton = GUI.Toggle (Rect (25, 25, 100, 30), toggleBool, "toggleButton", "button");

//style button as a toggle!
GUI.Button (Rect (10,140,180,20), "This is a button", "toggle");

}

You can read this in the GUI scripting guide, which is worth checking out for all the GUI references.

http://unity3d.com/support/documentation/Components/GUI%20Scripting%20Guide.html

I think I've seen this code somewhere :)

Now if you want to use `GUI.Button` instead of `GUI.Toggle`, replace this:

showWindow = GUI.Toggle (Rect (16, 16, 128, 24), showWindow, "Show My Window");

with that:

if (GUI.Button(Rect (16, 16, 128, 24), "Show My Window")) {
    showWindow = true;
}

Neither of these work---- what the inquire is asking, is how does one switch on-off buttons and how does one extend this functionality to a consecutive series of buttons as the player clicks the buttons in the required sequence; just like a "regular" - event driven GUI we would find on all the current MMOs.

To date (06/13/2010) there has been no answer to this debacle for the UNITY 3D GUI system..