- Home /
Create GUI elements outside of GUI.Window
I have tooltip code which is called within a GUI.Window callback. The code creates some GUI elements, but I want those elements to be 'outside' of the window, so it is not limited in size due to the window size. How would I go about doing this? Thanks
EDIT: Upon further investigation, the GUI.tooltip is not set outside of the gui.window callback. It is set within the callback though, does a GUI.Window get its own GUI instance?
Could you possibly provide a snipped of code where your tooltip is? I'm not sure I understand when you say the tooltip creates some GUI elements. Is this using unity's built-in tooltip?
It just does a GUI.Box and some GUI.Label's, but it's doing them in the context of the GUI.Window. I'd like it to create them outside of it (window), so it isn't limited by the window size. Hope that helps.
Answer by Molix · Feb 17, 2011 at 06:34 PM
I draw tooltips from an OnGUI that is outside of the window callback. Basically all the windows put their GUI.tooltip into a common spot that is accessed by the tooltip-drawing-OnGUI. Then they can be anywhere.
Upon further investigation, the GUI.tooltip is not set outside of the windows callback. It is set within the callback though, does a GUI.Window get its own GUI instance?
Each window or other OnGUI sets the shared tooltip (e.g. if GUI.tooltip != "" then sharedTooltip=GUI.tooltip), typically as the last thing in their function. Then a separate OnGUI (e.g. a "Tooltip $$anonymous$$anager"), with a GUI.depth that makes it the topmost, draws the sharedTooltip, and clears it.
Your answer
![](https://koobas.hobune.stream/wayback/20220613104903im_/https://answers.unity.com/themes/thub/images/avi.jpg)