- Home /
Stuck in "Failed to load window layout" loop
When working on a custom editor window in Unity 2020 I caused the editor to crash. Upon trying to re-open it I received a "Failed to load window layout" dialog with the option to load the default layout or to reset to factory. Neither of these solutions would fix the issue and my only recourse was to cancel opening the editor. Does anyone know how to get Unity back up and running?
Things I have tried:
Deleting the Library and other generated project files
Creating a new project (Results in the same error)
Uninstalling and re-installing Unity
Deleting AppData\Roaming\Unity\Editor-5.x\Preferences\Layouts\default\LastLayout.dwlt
Editor.log
Failed to load window layout: System.NullReferenceException: Object reference not set to an instance of an object
at UnityEditor.ContainerWindow.GetWindowID () [0x00070] in <a820952c8bdb44eba9c4c39808ab1e8a>:0
at UnityEditor.ContainerWindow.get_windowID () [0x00010] in <a820952c8bdb44eba9c4c39808ab1e8a>:0
at UnityEditor.ContainerWindow.SaveGeometry () [0x00001] in <a820952c8bdb44eba9c4c39808ab1e8a>:0
at UnityEditor.ContainerWindow.Save () [0x0000d] in <a820952c8bdb44eba9c4c39808ab1e8a>:0
at UnityEditor.ContainerWindow.Close () [0x00001] in <a820952c8bdb44eba9c4c39808ab1e8a>:0
at UnityEditor.WindowLayout.LoadWindowLayout (System.String path, System.Boolean newProjectLayoutWasCreated, System.Boolean setLastLoadedLayoutName, System.Boolean keepMainWindow) [0x000b7] in <a820952c8bdb44eba9c4c39808ab1e8a>:0
solution : it works 100% : https://www.youtube.com/watch?v=hGukVu1DR18
Answer by AtticusMarkane · Mar 29, 2020 at 08:40 PM
Managed to solve the issue with help from a colleague at Unity who pointed me to the public source code for this part of the editor.
I was on the right track. The issue was caused by the editor trying to reload my custom editor window but being unable to for whatever reason (probably broken tbh). Deleting LastLayout.dwlt in the Roaming folder should have resulted in the editor falling back to the default layout, however what I did not realize was that there is an equivalent CurrentLayout file in the Library for the project. Deleting both the LastLayout.dwlt and the Library/ before attempting to re-open the editor cleared up the issue.
While I am here I want to point out that all of the solutions that I previously tried are valid solutions for different occurrences of this error; They were provided and tested by other users and provided as valid answers in other questions. If my answer does not solve your problem, consider trying one of those.
Thank you so much for following up with your solution. Had the exact same problem, and deleting the CurrentLayout did the trick.
Thank you very much. It was the only thing that works. One annoying thing though, I need to do this every time I create a new project. Is there a permanent solution?
I have not had this problem and my guess would be that you have something in your custom editor UI that is repeatedly putting you into this state. I recommend disabling all of your custom editor UI and then enable them one at a time. This will be tedious, but it should help you pinpoint if one is breaking the layout. Good luck!
Oh man. Thank you so much. I got this error starting Unity 2020.1.6f1 for the first time. Not to mention I started it up for the purpose of Doing the Ludum Dare Game Jam. Seriously, man. You saved my butt.
Where is the CurrentLayout file? I have no clue as to where it is. I am new to unity and i was going to create a new project but it won't open when i press create or try to open otherwise
Its deeper in this directory: C:/Users/YourUserName/AppData/Roa$$anonymous$$g/Unity/
hi, sorry could you totally walk me through how to do this.. I am lost sorry
YES this solution does it. It happens that I started to get 2 windows on launch. One being black and if I close it it closes the project one and for all. Then the loop began... Prior to that I started using some custom package (that recorder one)
Anyways, removing the last layout from both the AppData and the your project folder works.
Now back to Unity. Thank you thank you!
Answer by zaxvax · Oct 01, 2020 at 12:37 PM
@metinevren Copying \Library\CurrentLayout-default.dwlt form any working project to problematic project works like a charm.
Answer by ahmedaniss · Oct 10, 2020 at 12:20 PM
problem fixed here : https://youtu.be/Av9zt1gcpqc
Does it fix it permanently though? I have this problem with every new project just like someone else in the solution comments.
It's not a fix it's a workaround. nothing on this page is a fix they are all workarounds.. to fix this damn issue one must change the algorithm and the code.
Answer by metinevren · Sep 19, 2020 at 04:26 AM
It did not work. I cannot open a newly created project!! So ther ecannot be custom windows!
Try deleting the stuff @matticus99 suggested after everytime you create a project
These settings are shared across projects iirc. I one project left it in a broken state, then a new project would not change it.
Not exactly. There is a last layout file saved in the Library folder of the project. With this file, you would open the same layout on every computer you'd use. And there are layout files in the appdata, which are cross project and used to create new projects.
After clicking "load default layout", go to the folder, make a copy of the LastLayout.dwlt. Because if you don't, Unity corrupts the file again.
Du must erst alle Layout löschen dann kommen neue.. .- aber lösche mit Unity oben in Delete Layouts...