关闭编辑器窗口。
执行此操作将销毁编辑器窗口。
\
显示 Close() 的简单示例
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); } }