EditorGUILayout
- BeginHorizontal
- BeginScrollView
- BeginToggleGroup
- BeginVertical
- BoundsField
- ColorField
- CurveField
- EndHorizontal
- EndScrollView
- EndToggleGroup
- EndVertical
- EnumPopup
- FloatField
- Foldout
- InspectorTitlebar
- IntField
- IntPopup
- IntSlider
- LabelField
- LayerField
- MinMaxSlider
- ObjectField
- PasswordField
- Popup
- PrefixLabel
- PropertyField
- RectField
- SelectableLabel
- Slider
- Space
- TagField
- TextArea
- TextField
- Toggle
- Vector2Field
- Vector3Field
- Vector4Field
EditorGUILayout.RectField 矩形字段
static function RectField (value : Rect, params options : GUILayoutOption[]) : Rect
static function RectField (label : string, value : Rect, params options : GUILayoutOption[]) : Rect
static function RectField (label : GUIContent, value : Rect, params options : GUILayoutOption[]) : Rect
Parameters参数
-
labelOptional label in front of the field. // 字段前面的可选标签。
-
valueThe value to edit. // 编辑的值
-
optionsAn optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style. See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。
Rect - The value entered by the user.
返回Rect,由用户输入的值。
Description描述
Make an X, Y, W & H field for entering a Rect.
制作 X, Y, W & H字段用于输入矩形。
Modify Another's window position and size values.
修改其他窗口位置和大小的值。
// Simple Script that lets you modify another's window position value
//修改其他窗口位置的值
// To use this script you need to open first the DummyWindow window.
//使用这个脚本必须首先打开DummyWindow窗口
class MoveResizeSelectedWindow extends EditorWindow {
var pos : Rect;
@MenuItem("Examples/Move - Resize other window")
static function Init() {
var window = GetWindow(MoveResizeSelectedWindow);
window.Show();
}
function OnGUI() {
DummyWindow.instance.position =
EditorGUILayout.RectField("Window's position:",
DummyWindow.instance.position);
if(GUILayout.Button("Reset position"))
DummyWindow.instance.position = Rect(0,0,200,200);
if(GUILayout.Button("Close"))
this.Close();
}
}
And the script that works with the example:
窗口的例子
// Dummy window that is going to be moved.
//窗口将被移动
class DummyWindow extends EditorWindow {
static var instance;
@MenuItem("Examples/Dummy Window")
static function Init() {
var window = GetWindow(DummyWindow);
window.Show();
}
function DummyWindow() {
instance = this;
}
}
最后修改:2011年7月14日 Thursday 17:14