Search Unity

Tooltips and EditorWindow.Repaint problems

Discussion in 'Immediate Mode GUI (IMGUI)' started by guavaman, Aug 24, 2013.

  1. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Unity 4 seems to have a problem drawing tooltips when an editor window is being repainted faster than the default speed. Calling EditorWindow.Repaint inside OnInspectorUpdate() or Update() increases the redraw speed of the GUI. This works great in Unity 3.5, but in 4.0+ it makes it nearly impossible to get a tooltip to pop up on an editor control.

    Try this out. Tool tips will be broken until you comment out the this.Repaint line near the bottom.

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4.  
    5. public class TooltipTest : EditorWindow {
    6.  
    7.   [MenuItem("Window/ToolTip Test")]
    8.     static void Init() {
    9.     TooltipTest window = (TooltipTest)EditorWindow.GetWindow(typeof(TooltipTest));
    10.             window.title = "Tooltip Test";
    11.             window.Show();
    12.     }
    13.    
    14.     void OnGUI() {
    15.    
    16.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    17.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    18.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    19.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    20.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    21.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    22.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    23.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    24.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    25.     EditorGUILayout.LabelField(new GUIContent("Label Text","This is a tooltip."));
    26.  
    27.     GUILayout.Button(new GUIContent("Button Text","This is a tooltip."));
    28.    
    29.     }
    30.    
    31.     void Update() {
    32.     this.Repaint(); // Increase repainting speed - Comment this out and suddenly tooltips work!
    33.     }
    34. }
    35.  
    I noticed this because I just published my Sprite Factory editor tool and noticed tooltips were not working on Unity 4. I need to redraw the editor window faster than the default rate because I have a real-time animation preview in my tool. Anyone know any workarounds?

    Bug reported.
     
    Last edited: Aug 24, 2013
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Just came across this bug myself, it still exists in Unity 4.5.0f6 :/
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Here's the fogbugz:

    [redacted because it exposes email addresses to bots]
     
    Last edited: Apr 16, 2021
  4. kingstone426

    kingstone426

    Joined:
    Jun 21, 2013
    Posts:
    44
    Not everyday you necro a thread from 2014 :)
    Did anyone find a workaround for this? Still experiencing it on 2020.2.3.
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    I didn't. I had to make my own tooltip system to replace their broken one.