BoundsField

示例程序
说明生成控制 Bounds 变量的区域

用法

public static Bounds BoundsField(Bounds value, params GUILayoutOption[] options);
public static Bounds BoundsField(string label, Bounds value, params GUILayoutOption[] options);
public static Bounds BoundsField(GUIContent label, Bounds value, params GUILayoutOption[] options);

参数

label

对应的标签名称。

value

该区域控制的 Bounds 类型变量。

options

(可选)用于指定额外的布局属性,该参数将覆盖默认样式。

示例

public override void OnInspectorGUI () {

		// First reload, no label, no extra options
		_target.BoundsFirst = EditorGUILayout.BoundsField (_target.BoundsFirst);
	
		// Second reload, with a label and a height of 200 pixels
		_target.BoundsSecond = EditorGUILayout.BoundsField ("Bounds Second", _target.BoundsSecond, GUILayout.Height (200));
	
		// Third reload, with a label, a tooltip and a size of 400 pixels * 100 pixels
		var guiContent = new GUIContent("Bounds Third", "This is the third bounds.");
		var guiLayoutOptions = new GUILayoutOption [] {
				GUILayout.Width(400),
				GUILayout.Height(100)
		};
		_target.BoundsThird = EditorGUILayout.BoundsField (guiContent, _target.BoundsThird, guiLayoutOptions);
}

编译结果如下: