Adding mouse hover tooltips using just GUILayout.Button...

Q. Using C#, How do I add tool tips on mouse hover when using just:

GUILayout.Button.

i.e

EditorGUILayout.BeginVertical();
if (GUILayout.Button(“View Matches Object”))
EditorApplication.ExecuteMenuItem(“GameObject/Align View to Selected”);
EditorGUILayout.EndVertical();

I can make them work with the following method, but then the button doesn’t scale itself when the window size of the inspector is changed (which is what I want)

if (GUILayout.Button(new GUIContent(“Unparent”, “This is the tooltip”), EditorStyles.miniButton, GUILayout.Width(128)))
{
}

If I try to put a tooltip in the same place just using GUILayout.Button the button itself seems to change and nothing else happens.

I.e

if (GUILayout.Button(“View Matches Object”, “Tooltip”))

I ideally want the buttons to scale with the window as they do with just GUILayout.Button,
but to have tooltips also.

Any Knowhow?
Thanks
Chris

1 Like

Take a look at tooltip. Not sure is it what you want and put your codes in a code tag

[code]
// codes
[/code]
1 Like