marijnz / unity-toolbar-extender

Extend the Unity Toolbar with your own Editor UI code.
MIT License
1.67k stars 168 forks source link

Request for editor layout buttons #9

Closed larssteenhoff closed 5 years ago

larssteenhoff commented 5 years ago

I'm not sure how to do it but I would like to make 4 buttons for the different editor layouts so I can quickly switch between them.

Can you help me out?

larssteenhoff commented 5 years ago

I found something that may be useful

https://support.unity3d.com/hc/en-us/articles/208298636-How-to-modify-the-Editor-Application-Layout-from-a-script

larssteenhoff commented 5 years ago

https://answers.unity.com/questions/382973/programmatically-change-editor-layout.html One more for Unity 2018

larssteenhoff commented 5 years ago
        // Loading layout from an asset
        //        LayoutUtility.LoadLayoutFromAsset("Assets/Editor/Layouts/Your Layout.wlt");
        string path = Path.Combine(Directory.GetCurrentDirectory(), "Assets/Editor/Layouts/Layout1.wlt");
        EditorUtility.LoadWindowLayout(path);

I found something that works

now I have 4 buttons that switch between layouts

marijnz commented 5 years ago

Great! :)

larssteenhoff commented 5 years ago

https://unitylist.com/p/hfu/Unity-Layout-Exporter

I'm saving my layout with this tool and after I load it with the toolbar buttons.

// Loading layout from an asset
    //        LayoutUtility.LoadLayoutFromAsset("Assets/Editor/Layouts/Your Layout.wlt");
    string path = Path.Combine(Directory.GetCurrentDirectory(), "Assets/Editor/Layouts/Layout1.wlt");
    EditorUtility.LoadWindowLayout(path);

It works in unity 2018.3.

but for some reason does not work in 2019.2 they must have changed something again.