RectField, RectIntField
示例程序 | |
---|---|
说明 | 生成控制 Rect 或 RectInt 变量的区域 |
用法
二者用法一致,修改相应的函数名即可。
public static Rect RectField(Rect value, params GUILayoutOption[] options);
public static Rect RectField(string label, Rect value, params GUILayoutOption[] options);
public static Rect RectField(GUIContent label, Rect value, params GUILayoutOption[] options);
参数
label
对应的标签名称。
value
该区域控制的 Rect
或 RectInt
类型变量。
options
(可选)用于指定额外的布局属性,该参数将覆盖默认样式。
示例
public override void OnInspectorGUI () {
_target.Rect = EditorGUILayout.RectField ("Rect", _target.Rect);
_target.RectInt = EditorGUILayout.RectIntField ("Rect Int", _target.RectInt);
}
编译结果如下:
Rect
区域各分量可以取浮点值, RectInt
区域可分量之可以取 int
类型的值。