public static Rect BeginVertical (params GUILayoutOption[] options);
public static Rect BeginVertical (GUIStyle style, params GUILayoutOption[] options);

参数

style可选 GUIStyle
options一个可选的布局选项列表,用于指定额外的布局属性。 此处传递的任何值都将覆盖 style 定义的设置。
另请参阅:GUILayout.WidthGUILayout.HeightGUILayout.MinWidthGUILayout.MaxWidthGUILayout.MinHeightGUILayout.MaxHeightGUILayout.ExpandWidthGUILayout.ExpandHeight

描述

开始一个垂直组并找回其矩形。

此方法是对 GUILayout.BeginVertical 的扩展。可用于 创建复合控件。


Vertical Compound group.

// Create a Vertical Compound Button

using UnityEngine; using UnityEditor;

public class BeginVerticalExample : EditorWindow { [MenuItem("Examples/Begin-End Vertical usage")] static void Init() { BeginVerticalExample window = (BeginVerticalExample) EditorWindow.GetWindow(typeof(BeginVerticalExample), true, "My Empty Window"); window.Show(); }

void OnGUI() { Rect r = (Rect)EditorGUILayout.BeginVertical("Button"); if (GUI.Button(r, GUIContent.none)) Debug.Log("Go here"); GUILayout.Label("I'm inside the button"); GUILayout.Label("So am I"); EditorGUILayout.EndVertical(); } }