此窗口是否已最大化?
要将自定义编辑器窗口最大化到 Unity 屏幕的大小,请设置 maximized
。仅当自定义编辑器窗口停靠在 Unity 内时才有效。
using UnityEditor; using UnityEngine; using UnityEngine.UIElements; public class MaximizedExample : EditorWindow { [MenuItem("Examples/Maximized Window Example")] public static void ShowExample() { MaximizedExample wnd = GetWindow<MaximizedExample>(); wnd.titleContent = new GUIContent("MaximizedExample"); } public void CreateGUI() { var toggle = new Toggle("Maximize window"); toggle.value = this.maximized; rootVisualElement.Add(toggle); } }