GUI.Window are completely seperate containers and form a container for all the rest, they can’t be contained in anything else aside of OnGUI itself
Depending on what you want to do in detail, BeginArea / BeginGroup are what you might actually be looking for (subcontainer within another container like a scrollview)
a. instance a GUI.Window
b. scroll the window both vertically and horizontally
c. make the window dragable
then read this code
public Vector2 scrollPosition = Vector2.zero;
void OnGUI()
{
// Required so that all GUI Controls render relative to (0,0) inside the window
GUI.BeginGroup(windowRect);
// Call the window
windowRect = GUI.Window(0, windowRect, DoMyWindow, "Inventory");
GUI.EndGroup();
}
private Vector2 scrollViewVector = Vector2.zero;
void DoMyWindow(int windowID)
{
// Begin the ScrollView (First Rect defines the size of the scrollview, Second Rect defines the size of the view of controls
// If the size of your controls dont fit into the size of your scrollview then horizontal or vertical scrollbars appear
scrollViewVector = GUI.BeginScrollView (new Rect (0, 20, inventory_width-5, inventory_height-25), scrollViewVector, new Rect (0, 0, 0, top_offset+entry_pos+25));
// My Controls (Put what you like in here)
entry_pos=top_offset;
displayEntries(rootnode);
// End the ScrollView
GUI.EndScrollView();
// Add this line to make the window dragable
GUI.DragWindow (new Rect (0,0, 10000, 20));
}