The attached script will let you choose one window layout for Edit mode and another for Play / Debug mode, and switch between them automatically. I have been whining about this on and off for two years (and 8 years ago somebody else requested the feature) so I figured I should just get off my butt and fix it myself.
Drop the script into an Editor folder in your Assets folder (it doesn’t need its own folder despite what is shown in the attached thumbnail), then choose Window → Automatic Layout Swap to choose the layouts for each mode. You can enable/disable the swap, you can choose default settings applied to new projects, and you can choose the settings for the current project.
Project settings will be stored in a txt file in the same Editor folder where you put this script. Since they’re user-specific, exclude “EditorLayoutSwapper.project_prefs.txt” from source control.
Note also that the “Maximize on Play” setting is part of the layout settings, not project settings. That means you have to manually load the Play layout, change it, and save it, if you need to change it while you’re using this script. (That one threw me for a minute or two…)
This also will not save any layout changes you may have made but haven’t saved. Unity doesn’t expose the name of the current layout, nor does it expose a means to force a save.
Finally, this works for Windows developers only. Unity keeps editor layouts as individual files in the user’s appdata folder, so retrieving the available layouts is highly OS-dependent.


