Basic GUI Question

I am looking at the overview and tried the following:

function OnGUI () {
    // Make a background box
    GUI.Box (Rect (10,10,100,90), "GUI Basics");

    // Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
    if (GUI.Button (Rect (20,40,80,20), "Level 1")) {
        GUI.Label(Rect (60, 40, 80, 20), "you hit LoadLevel (1), but this does nothing yet");
    }

    // Make the second button.
    //if (GUI.Button (Rect (20,70,80,20), GUIContent ("Level 2", "This is the tooltip"))); 
    if (GUI.Button (Rect (20,70,80,20), GUIContent("Level 2", "Yep - tooltip"))) 
    {

        print ("You hit LoadLevel (2), but this does nothing yet");
    }
}

Problem 1) When I click on button 1, I do not see a label pop up Probem 2) I do not see a tooltip when I hover over button 2

Suggestions?

Thx

1. GUI.Button returns true only the frame that you pressed the button You can do like :

var test : bool; //default is false

function OnGUI()
{
    if (GUI.Button (Rect (20,40,80,20), "Level 1")) {
        test = true;
    }
    if(test){
        GUI.Label(Rect (60, 40, 80, 20), "you hit LoadLevel (1), but this does nothing yet");
    }
}

simple ahh? i know :)

2. Tooltips don't show up automatically, they just set the value of GUI.tooltip, which you have to show yourself.

function OnGUI () {
// Make a button using a custom GUIContent parameter to pass in the tooltip.
GUI.Button (Rect (10,10,100,20), GUIContent ("Click me", "This is the tooltip"));

// Display the tooltip from the element that has mouseover or keyboard focus
GUI.Label (Rect (10,40,100,40), GUI.tooltip);
}

this should work :

var test;
function OnGUI () {
    // Make a background box
    GUI.Box (Rect (10,10,100,90), "GUI Basics");

// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
 if (GUI.Button (Rect (20,40,80,20), "Level 1")) {
        test = true;
    }
    if(test){
        GUI.Label(Rect (60, 40, 80, 20), "you hit LoadLevel (1), but this does nothing yet");
    }

// Make a button using a custom GUIContent parameter to pass in the tooltip.
    GUI.Button (Rect (10,10,100,20), GUIContent ("Click me", "This is the tooltip"));

// Display the tooltip from the element that has mouseover or keyboard focus
GUI.Label (Rect (10,40,100,40), GUI.tooltip);

}

Thanks, but what would the final script look like using both of these?

How about if i wanted to capture the current time and display the label for button 1 for 1000ms?