- Home /
Custom Inspector tooltips behaving inconsistently
See video here: http://www.youtube.com/watch?v=IZ3T-Hwx5J8
My custom Inspector's tooltips are behaving very badly. Hovering over an element does not display its tooltip; hovering then moving the mouse to another tooltipped element occasionally does show the tooltip.
Disabling the RepaintAll calls from the Gizmo function animating in the scene view does not fix the issue.
The toggles are created with this function:
public static void DefaultField( ref bool arg, GUIContent label ) { arg = EditorGUILayout.Toggle(label,arg);}
And they are inside this nesting:
GUILayout.Vertical()
GUILayout.Horizontal()
GUILayout.Space(20)
GUILayout.Vertical()
toggles
/
/
/
I'm at a loss. Any hints?
Edit: Just tried a simple Editor with only a basic Toggle in it, same result.
I tried this too and had similar results: sometimes they showed up immediately, sometimes after a while, sometimes never.
You could make a TextArea/Field/Label whatever at the bottom of your inspector and show the tooltip there as a quick fix.
rrrgh, i have like fifty inspectors
time to make a BetterEditor to extend i guess~~
edit: well, no, that's so much work and definitely not straightforward. tooltips should work all the time, not some of the time; i shouldn't have to make some ridiculous class or create some function I always have to call in every GUI segment to make them work.
I made a terrible thing which is horrible but it consistently displays the tooltips...
if you put "ForcedTooltip.CaptureTooltip()" at the end of every single editor @_X
using UnityEngine;
using UnityEditor;
public class ForcedTooltip : EditorWindow {
[$$anonymous$$enuItem("Tools/Enable Forced Tooltip")]
public static void Enable() {
ForcedTooltip ft = EditorWindow.GetWindow<ForcedTooltip>();
}
private static bool hide = true;
private static string tooltip = "";
public static string Tooltip {
set {
tooltip = value;
if ( !hide ) {
ForcedTooltip ft = EditorWindow.GetWindow<ForcedTooltip>();
float x, y;
x = GUI.skin.label.CalcSize(new GUIContent(tooltip,"")).x + 20;
y = GUI.skin.label.CalcHeight(new GUIContent(tooltip,""),x) + 45;
try {
ft.$$anonymous$$Size = new Vector2(x,y);
ft.position = new Rect(Screen.currentResolution.width-x,0,x,y);
ft.Show();
} catch ( System.Exception ) { }
}
} }
public static void CaptureTooltip() { if ( GUI.tooltip != "" ) Tooltip = GUI.tooltip; }
private void OnInspectorUpdate() { Repaint(); }
private void OnGUI() {
hide=EditorGUILayout.Toggle("Disable Autosizing",hide);
GUI.skin.label.wordWrap = true;
GUILayout.Label(tooltip);
GUI.skin.label.wordWrap = false;
}
}