Unity-Technologies/UnityCsReference · error · LayoutException
No parent view
Error message
No parent view
What it means
During the 'maximize main view' / un-maximize flow, the code expects to find a parent view to reparent the docked pane into; if no parent view exists it throws LayoutException. This guards against an inconsistent host-view hierarchy that would otherwise leave the window in a broken docking state.
Source
Thrown at Editor/Mono/GUI/WindowLayout.cs:1007
newDockArea.RemoveTab(oldWindow);
UnityObject.DestroyImmediate(oldWindow);
foreach (UnityObject o in newWindows)
{
EditorWindow curWin = o as EditorWindow;
if (curWin != null)
curWin.MakeParentsSettingsMatchMe();
}
parent.Initialize(parent.window);
//If parent window had to be resized, call this to make sure new size gets propagated
parent.position = parent.position;
oldRoot.Reflow();
}
else
{
throw new LayoutException("No parent view");
}
// Kill the maximizedMainView
UnityObject.DestroyImmediate(maximizedHostView);
win.Focus();
var gv = win as GameView;
if (gv != null)
gv.m_Parent.EnableVSync(gv.vSyncEnabled);
}
catch (Exception ex)
{
Debug.Log("Maximization failed: " + ex);
ResetAllLayouts();
}
}
View on GitHub (pinned to 225b0fbdb5)
Solutions
- Ensure the window still has a valid parent container before triggering maximize/un-maximize.
- Reset the layout to default to restore a consistent view hierarchy.
- Avoid programmatically reparenting host views; use the documented docking API.
- If scripting maximize, check that maximizedHostView has a parent before invoking the operation.
Defensive patterns
Strategy: validation
Validate before calling
// confirm the host view has a parent before maximize/un-maximize if (hostView?.parent == null) return;
Try / catch
try { /* maximize routine */ }
catch (LayoutException ex) when (ex.Message == "No parent view")
{ /* reset to default layout */ } Prevention
- Do not programmatically detach host views from their containers.
- Reset the layout when docking state becomes inconsistent.
- Use the documented docking API rather than direct reparenting.
When it happens
Trigger: Calling the maximize/un-maximize routine when the current host view has no parent (e.g. it is already the root container); a layout state where the GameView/SceneView was orphaned by a previous failed dock operation; programmatic window manipulation that detached the pane from its container.
Common situations: Editor extension that moves windows between containers; a docking bug that orphaned a pane; recovering from a previously aborted layout load.
Related errors
- Error while reading window layout: no root view on main wind
- Error while reading window layout: no main window found
- Invalid split view data
- No windows found in layout.
- Must be greater than zero.
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/f9226479db828c1c.
Report an issue: GitHub.