public bool maximized ;



设置 maximized 将使 Unity 编辑器 与 Unity 屏幕一样大。如果窗口未停靠,则此值将始终为 false, 并且设置此值没有任何效果。这由 GUILayout.Toggle 选项处理。

using UnityEngine;
using UnityEditor;

// The window size increases as full as Unity. // This only work when the editor window is inside Unity.

public class MaximizedExample : EditorWindow { [MenuItem("Examples/Maximized")] public static void Init() { GetWindow<MaximizedExample>("Maximized"); }

void OnGUI() { maximized = GUILayout.Toggle(maximized, "Maximize window"); } }