When embedding the handler for GUILayout.Button (eg:
if (GUILayout.Button(GUIContent(expertCount.ToString(),expertiseIcon,"Expertise"))) {
GUILayout.Label(GUI.tooltip);
// insert handing for button click
}
No tooltip is displayed. However:
GUILayout.Button (GUIContent(expertCount.ToString(),expertiseIcon,"Expertise"));
GUILayout.Label(GUI.tooltip);
DOES work. Am I doing something wrong ?[/code]
better example of the ‘if’ case:
function OnGUI () {
GUILayout.Label(GUI.tooltip);
if (GUILayout.Button (GUIContent(expertCount.ToString(),expertiseIcon,"Expertise"))) {
// handle event
}
I put in Debug.Log(GUI.tooltip) just in case it was only happening when I clicked the button, but nothing was ever displayed.
sigh…never mind. Didn’t know the GUI.tooltip wipes itself on every cycle (makes sense in hindsight).
thanks again.