Yield WaitforSeconds in the GUI

Hi,

I have implemented a tooltip on my customized buttons. Now my target is to visualize this tooltip after a few seconds that the mouse is on the button…

I have read some post about the “WaitForSeconds” function (such as: http://forum.unity3d.com/viewtopic.php?t=13692&highlight=yeild+yield), but I think I’m a little bit confused…:roll:

private var wait : boolean = true;


//TOOLTIP

if(GUI.tooltip != ""){

	tooltipSize = myStyle.CalcSize(GUIContent(GUI.tooltip));
	tooltipWait(3);
	if(wait){
		GUI.Label(Rect (Event.current.mousePosition.x-150,Event.current.mousePosition.y-100,tooltipSize.x+50,tooltipSize.y+50), GUI.tooltip, myStyle);
		}
	}
}

public function tooltipWait (seconds : float) {
	wait = false;
	yield WaitForSeconds(seconds);
	wait = true;
	}

It doesn’t appear… :cry:

Thanx for the help…

file:///Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference/GUI-tooltip.html