EditorWindow : add tabs and a menu?

Hi there,

I have two questions regarding implementing a custom editor window.
1 How can i add tabs to my window in code?

2 How can i add a menu to my window like the ones found at the console tab. see image below.

I’ve tried to implement the GenericMenu but there is no info about this in the class reference…

Thanx in advance

367618--12749--$menu_155.jpg

You can’t do this; each tab is actually an editor window that has been docked. You can create multiple editor windows, then dock them so they appear as tabs – but I don’t think there’s a way to dock windows from scripts.

See the Popup() and related functions in EditorGUI/EditorGUILayout.

1 Like

Old thread but stumbled across it while looking for a solution. You now can add Tabs to a window using:

Reference:
static function GetWindow. (title : String, focus : boolean, params desiredDockNextTo : System.Type[ ]) : T

Parameters
T The type of the window. Must derive from EditorWindow.
title If GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.
desiredDockNextTo An array of EditorWindow types that the window will attempt to dock onto.

In my case I wanted two custom windows to always be docked with each other. In the init for WindowA I try to make it dock to WindowB. For the init of WindowB I try to make it dock to WindowA. If the docking window does not exist, it just makes a solitary window.

Example:
[MenuItem (“Window/WindowA &a”, false, 111)]
public static void Init(){
EditorWindow window = EditorWindow.GetWindow(typeof(WindowB));
window.Show();
}

3 Likes

great, many thanks, I’m looking for the solution, thanks all your guys from 8~9 years ago

2 Likes