GUI.Window. Wanting to allow clickthrough
Hey,
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);
void OnGUI()
{
BeginWindows();
parentRect = GUI.Window(0, parentRect, OnParentWindow, "ParentWindow");
GUI.BringWindowToFront(0);
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;
GUI.BringWindowToFront(1);
EndWindows();
}
void OnParentWindow(int id)
{
GUI.DragWindow();
}
void OnChildWindow(int id)
{
GUI.DragWindow();
}
Is there any way to do this?
Thanks.
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
Your answer
![](https://koobas.hobune.stream/wayback/20220612113018im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to change the text of EditorGUILayout.TextField 2 Answers
My EditorWindow won't display properly, even when commented out. 0 Answers
How to Have a ReoderableList in a Custom Editor Window 1 Answer
Editor Int sliders affecting each other 0 Answers
Do Unity Editor GUI Utilities (Handles.DrawLine & EditorGUI.DrawRect) have limitations? 2 Answers