# GetWindow

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

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.5/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

## GetWindow(Type, bool, string, bool)

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

```csharp
public static EditorWindow GetWindow(Type windowType, bool utility, string title, bool focus)
```

### Parameters

**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The type of the window. Must derive from EditorWindow.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Set this to true, to create a floating utility window, false to create a normal window.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to give the window focus, if it already exists. (If GetWindow creates a new window, it will always get focus).

### Returns

| Type                                                                        | Description                               |
| --------------------------------------------------------------------------- | ----------------------------------------- |
| [EditorWindow](/engine/6000.5/script-reference/unityeditor/editorwindow.md) | An EditorWindow instance of `windowType`. |

### Remarks

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

![GetWindowEx (GetWindow)](/api/media?file=/engine/6000.5/media/images/GetWindowEx.png)

*Simple Empty non-dockable window.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

// Simple script that creates a new non-dockable window.
public class EditorWindowTest : EditorWindow
{
    [MenuItem("Examples/Display simple Window")]
    static void Initialize()
    {
        var window = (EditorWindowTest)EditorWindow.GetWindow(typeof(EditorWindowTest), true, "My Empty Window");
    }
}
```

## GetWindow\<T>()

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

```csharp
public static T GetWindow<T>() where T : EditorWindow
```

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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

## GetWindow\<T>(bool)

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

```csharp
public static T GetWindow<T>(bool utility) where T : EditorWindow
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Set this to true, to create a floating utility window, false to create a normal window.

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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

## GetWindow\<T>(bool, string)

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

```csharp
public static T GetWindow<T>(bool utility, string title) where T : EditorWindow
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Set this to true, to create a floating utility window, false to create a normal window.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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

## GetWindow\<T>(string)

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

```csharp
public static T GetWindow<T>(string title) where T : EditorWindow
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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

## GetWindow\<T>(string, bool)

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

```csharp
public static T GetWindow<T>(string title, bool focus) where T : EditorWindow
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to give the window focus, if it already exists. (If GetWindow creates a new window, it will always get focus).

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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

## GetWindow\<T>(bool, string, bool)

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

```csharp
public static T GetWindow<T>(bool utility, string title, bool focus) where T : EditorWindow
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Set this to true, to create a floating utility window, false to create a normal window.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to give the window focus, if it already exists. (If GetWindow creates a new window, it will always get focus).

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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

## GetWindow\<T>(Type\[])

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

```csharp
public static T GetWindow<T>(params Type[] desiredDockNextTo) where T : EditorWindow
```

### Parameters

**** (\[Type\[]]\(https\://learn.microsoft.com/dotnet/api/system.type)): An array of EditorWindow types that the window will attempt to dock onto.

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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.

## GetWindow\<T>(string, Type\[])

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

```csharp
public static T GetWindow<T>(string title, params Type[] desiredDockNextTo) where T : EditorWindow
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.**** (\[Type\[]]\(https\://learn.microsoft.com/dotnet/api/system.type)): An array of EditorWindow types that the window will attempt to dock onto.

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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.

## GetWindow\<T>(string, bool, Type\[])

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

```csharp
public static T GetWindow<T>(string title, bool focus, params Type[] desiredDockNextTo) where T : EditorWindow
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If GetWindow creates a new window, it will get this title. If this value is null, use the class name as title.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to give the window focus, if it already exists. (If GetWindow creates a new window, it will always get focus).**** (\[Type\[]]\(https\://learn.microsoft.com/dotnet/api/system.type)): An array of EditorWindow types that the window will attempt to dock onto.

### Returns

| Type | Description                           |
| ---- | ------------------------------------- |
| T    | An EditorWindow instance of type `T`. |

### Remarks

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.
