Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

EditorWindow.GetWindow

static function GetWindow(t: Type, utility: bool = false, title: string = null, focus: bool = true): EditorWindow;
static EditorWindow GetWindow(Type t, bool utility = false, string title = null, bool focus = true);
static def GetWindow(t as Type, utility as bool = false, title as string = null, focus as bool = true) as EditorWindow

Parameters

tThe type of the window. Must derive from EditorWindow.
utilitySet this to true, to create a floating utility window, false to create a normal window.
titleIf GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.

Description

Returns the first EditorWindow of type t which is currently on the screen.

If there is none, creates and shows new window and returns the instance of it.


Simple Empty non-dockable window.

	// Simple script that creates a new non-dockable window
	
	import UnityEditor;
	
	class GetWindowEx extends EditorWindow {	
		@MenuItem("Example/Display simple Window")
		static function Initialize() {
			var window : GetWindowEx = EditorWindow.GetWindow(GetWindowEx, true, "My Empty Window");
		}
	}
static function GetWindow(): T;
static T GetWindow();
static def GetWindow() as T
static function GetWindow(utility: bool): T;
static T GetWindow(bool utility);
static def GetWindow(utility as bool) as T
static function GetWindow(utility: bool, title: string): T;
static T GetWindow(bool utility, string title);
static def GetWindow(utility as bool, title as string) as T
static function GetWindow(title: string): T;
static T GetWindow(string title);
static def GetWindow(title as string) as T
static function GetWindow(title: string, focus: bool): T;
static T GetWindow(string title, bool focus);
static def GetWindow(title as string, focus as bool) as T
static function GetWindow(utility: bool, title: string, focus: bool): T;
static T GetWindow(bool utility, string title, bool focus);
static def GetWindow(utility as bool, title as string, focus as bool) as T

Parameters

TThe type of the window. Must derive from EditorWindow.
utilitySet this to true, to create a floating utility window, false to create a normal window.
titleIf GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.

Description

Returns the first EditorWindow of type T which is currently on the screen.

If there is none, creates and shows new window and returns the instance of it.

static function GetWindow(params desiredDockNextTo: Type[]): T;
static T GetWindow(params Type[] desiredDockNextTo);
static def GetWindow(*desiredDockNextTo as Type[]) as T
static function GetWindow(title: string, params desiredDockNextTo: Type[]): T;
static T GetWindow(string title, params Type[] desiredDockNextTo);
static def GetWindow(title as string, *desiredDockNextTo as Type[]) as T
static function GetWindow(title: string, focus: bool, params desiredDockNextTo: Type[]): T;
static T GetWindow(string title, bool focus, params Type[] desiredDockNextTo);
static def GetWindow(title as string, focus as bool, *desiredDockNextTo as Type[]) as T

Parameters

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

Description

Returns the first EditorWindow of type T which is currently on the screen.

If there is none, creates and shows new window and returns the instance of it. The created window will attempt to be docked next to the first founds specified window type.