Unity Custom window with side-by-side tabs

I am creating my own window editor in unity and I am unable to load multiple tabs side by side when I click on a menu item.

This is what I got so far:

Dock 1

This is how I would like it to look when it loads:

Dock 2

Here's what I do to get the effect of the first image. What do I need to add / change to get the effect of the second image?

[MenuItem ("GameObject/My Editor")]
public static void ShowWindow() {
    EditorWindow hierarchyWindow = GetWindow<QEHierarchy>("Hierarchy");
    EditorWindow eventsWindow = GetWindow<QEEvents>("Events", typeof(QEHierarchy));

    hierarchyWindow.Show();
}

      

+3


source to share


1 answer


As I understand it from the Unity Scripting Reference , the second parameter in the method GetWindow

defines the other tab after which you want to dock your new tab. So given your code, the second parameter typeof(QEHierarchy)

is the culprit that puts your new tab side by side in the same window.

Delete it.

Further explanation (From the link I added above)



public static T GetWindow(string title, params Type[] desiredDockNextTo);

      

Where:

  • T → Window type. Should come from EditorWindow.
  • title -> If GetWindow creates a new window, it will get this title. If this value is null, use the class name as a header.
  • wishDockNextTo → An array of EditorWindow types that the window will try to do the dock.
0


source







All Articles