{"record":{"id":"234b744a66e9b145","repo":"Unity-Technologies/UnityCsReference","slug":"no-windows-found-in-layout","errorCode":null,"errorMessage":"No windows found in layout.","messagePattern":"No windows found in layout\\.","errorType":"exception","errorClass":"LayoutException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/GUI/WindowLayout.cs","lineNumber":1325,"sourceCode":"                CloseWindows(flags.HasFlag(LoadWindowLayoutFlags.KeepMainWindow));\n\n                ContainerWindow mainWindowToSetSize = null;\n                ContainerWindow mainWindow = null;\n\n                UnityObject[] remainingContainers = Resources.FindObjectsOfTypeAll(typeof(ContainerWindow));\n                foreach (ContainerWindow window in remainingContainers)\n                {\n                    if (mainWindow == null && window.showMode == ShowMode.MainWindow)\n                        mainWindow = window;\n                    else\n                        window.Close();\n                }\n\n                // Load data\n                UnityObject[] loadedWindows = InternalEditorUtility.LoadSerializedFileAndForget(path);\n\n                if (loadedWindows == null || loadedWindows.Length == 0)\n                    throw new LayoutException(\"No windows found in layout.\");\n\n                List<UnityObject> newWindows = new List<UnityObject>();\n\n                // At this point, unparented editor windows are neither desired nor desirable.\n                // This can be caused by (legacy) serialization of FallbackEditorWindows or\n                // other serialization hiccups (note that unparented editor windows should not exist in theory).\n                // Same goes for empty DockAreas (no panes).  Leave them behind.\n                for (int i = 0; i < loadedWindows.Length; i++)\n                {\n                    UnityObject o = loadedWindows[i];\n\n                    if (o is EditorWindow editorWin)\n                    {\n                        if (!editorWin || !editorWin.m_Parent || !editorWin.m_Parent.window)\n                        {\n                            Console.WriteLine($\"[LAYOUT] Removed un-parented EditorWindow while reading window layout\" +\n                                              $\" window #{i}, type={o.GetType()} entityId={o.GetEntityId()}\");\n                            UnityObject.DestroyImmediate(editorWin, true);","sourceCodeStart":1307,"sourceCodeEnd":1343,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/GUI/WindowLayout.cs#L1307-L1343","documentation":"LoadWindowLayout deserializes a layout file via InternalEditorUtility.LoadSerializedFileAndForget and expects at least one UnityObject (typically ContainerWindows). If the file is empty or yields zero objects, the layout is unusable and a LayoutException is thrown. This is the top-level guard against totally empty or fully unreadable layout files.","triggerScenarios":"Loading a zero-byte or fully-corrupt .wlt file; a path that points to a file with no serialized windows; a deserialization failure that silently returned an empty array.","commonSituations":"A truncated layout file after a disk-full or crash during save; pointing LoadWindowLayout at a non-layout file; a permissions issue preventing deserialization.","solutions":["Delete or replace the bad layout file and fall back to the default layout.","Verify the path passed to LoadWindowLayout actually contains a valid serialized layout.","Restore the layout file from a backup or source control.","If you ship a custom default layout, validate it loads in a clean editor before distribution."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// check file is non-trivial before loading\nvar fi = new FileInfo(path);\nif (!fi.Exists || fi.Length == 0) return; // will trigger default-layout fallback","typeGuard":null,"tryCatchPattern":"try { LoadWindowLayout(path); }\ncatch (LayoutException ex) when (ex.Message.Contains(\"No windows found\"))\n{ LoadDefaultWindowLayout(); }","preventionTips":["Maintain backups of layout files.","Validate layout file paths before loading.","Watch for disk-full conditions during save."],"tags":["window-layout","serialization","corrupt-data","editor","validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}