Version: 2022.3
言語: 日本語
public void Close ();

説明

エディターウィンドウを閉じます

This will destroy the editor window.


Simple example to show Close()

using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

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

public void CreateGUI() { // Each editor window contains a root VisualElement object VisualElement root = rootVisualElement;

// Create button Button closebutton = new Button(); closebutton.text = "Close!";

// Set up event handler closebutton.RegisterCallback<ClickEvent>((ClickEvent evt) => { this.Close(); });

root.Add(closebutton);

} }