# Close()

> Close the editor window.

## Definition

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

```csharp
public void Close()
```

### Remarks

This will destroy the editor window.

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

*Simple example to show Close()*

### Examples

```csharp
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

public class CloseWindow : EditorWindow
{
    [MenuItem("Examples/Close Window")]
    public static void ShowExample()
    {
        CloseWindow wnd = GetWindow<CloseWindow>();
        wnd.titleContent = new GUIContent("CloseWindow");
    }

    public void CreateGUI()
    {
        var closeButton = new Button();
        closeButton.text = "Close!";
        closeButton.clicked += () =>
        {
            this.Close();
        };

        rootVisualElement.Add(closeButton);
    }
}
```
