Search Unity

[Solved] tooltip/GUI.Button not working

Discussion in 'Immediate Mode GUI (IMGUI)' started by Zug, Nov 25, 2009.

  1. Zug

    Zug

    Joined:
    Nov 25, 2009
    Posts:
    10
    When embedding the handler for GUILayout.Button (eg:
    Code (csharp):
    1.  
    2. if (GUILayout.Button(GUIContent(expertCount.ToString(),expertiseIcon,"Expertise"))) {
    3.  
    4.     GUILayout.Label(GUI.tooltip);
    5. // insert handing for button click
    6. }
    7.  
    No tooltip is displayed. However:
    Code (csharp):
    1.  
    2. GUILayout.Button (GUIContent(expertCount.ToString(),expertiseIcon,"Expertise"));
    3.    
    4. GUILayout.Label(GUI.tooltip);
    5.  
    DOES work. Am I doing something wrong ?[/code]
     
  2. Zug

    Zug

    Joined:
    Nov 25, 2009
    Posts:
    10
    better example of the 'if' case:
    Code (csharp):
    1.  
    2. function OnGUI () {
    3.   GUILayout.Label(GUI.tooltip);
    4.  
    5.   if  (GUILayout.Button (GUIContent(expertCount.ToString(),expertiseIcon,"Expertise"))) {
    6. // handle event
    7.   }
    8.  
    I put in Debug.Log(GUI.tooltip) just in case it was only happening when I clicked the button, but nothing was ever displayed.
     
  3. Zug

    Zug

    Joined:
    Nov 25, 2009
    Posts:
    10
    sigh..never mind. Didn't know the GUI.tooltip wipes itself on every cycle (makes sense in hindsight).

    thanks again.