Close()
Close the editor window.
Read time 1 minuteLast updated 5 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public void Close()
Remarks
This will destroy the editor window.

Simple example to show Close()
Examples
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); }}