I'm playing with GUI.Window. I want to know if it is possible to have a GUI.Window that doesn't take focus/eat input events when clicking and there is no graphic.
In this example, I want to be able to click through the child window so I can still drag the parent around.
I've tried to Set the GUIContent/GUIStyle to non, and GUI.Color.a = 0; Both of these make the window invisible, however it still takes focus.
Rect parentRect = new Rect(0, 0, 300, 300);
Rect childWindowRect = new Rect(0, 0, 150, 150);
parentRect = GUI.Window(0, parentRect, OnParentWindow, "ParentWindow");
Rect cr = childWindowRect;
cr.position += parentRect.position;
GUIStyle childStyle = GUI.skin.window; // GUIStyle.none;
Rect newRect = GUI.Window(1, cr, OnChildWindow, "ChildWindow", childStyle);
childWindowRect.position += newRect.position - cr.position;
void OnParentWindow(int id)
void OnChildWindow(int id)
Is there any way to do this?
Whether it is possible or not doesn't matter for my needs now.
Realised I just ignore even calling GUI.Windows or set it's width/height to 0. And that allows it to serve as an empty container object for any child windows
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
155 People are following this question.
How to change the text of EditorGUILayout.TextField
My EditorWindow won't display properly, even when commented out.
Can't update ObjectField after object is selected
How to make my scene object reference survive the button play