Display tooltip Layout only if there is a tooltip to display

Hello,
I have a problem. I have made a tooltip using GUI.tooltip and I want to display it with a skin (basically in a box), and of course I want to display this box only if there is a tooltip to display, so I tried:

if (GUI.tooltip != string.Empty)
{
	Cursor.visible = false;
	GUI.skin = toolTipSkin;
	GUI.BeginGroup(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, TOOLTIP_MAX_WIDTH, 500));
	GUILayout.Box(GUI.tooltip, GUILayout.MaxWidth(TOOLTIP_MAX_WIDTH));
	GUI.EndGroup();
}
else
	Cursor.visible = true;

Unfortunately, it does not work :confused: (this code is called inside the OnGui method). I got the error ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint Aborting
How can I do?

Thanks in advance,
Dark Patate

hi;
first of all gui function is heavy , even unity dont reccomend it to be used in game build;

i did create a tooltip system before and what i did was using a UI.Text as tooltip text and a UI.Image as the back ground;

i created a function so these 2 ui always follow mouse position;

when ever i need them i just enabled their object and change the value of text ui ;

===================================