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.Vector2Field 二维向量字段
static function Vector2Field (label : string, value : Vector2, params options : GUILayoutOption[]) : Vector2
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
指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。
Vector2 - The value entered by the user.
返回Vector2,由用户输入的值。
Description描述
Make an X & Y field for entering a Vector2.
制作X & Y字段用于输入Vector2。
Measure the distance between 2 points.
测量2点之间的距离。
// Simple Script that measures the distance between 2 points
//测量2点之间的距离。
class EditorGUILayoutVector2Field extends EditorWindow {
var distance : float = 0;
var p1 : Vector2;
var p2 : Vector2;
@MenuItem("Examples/Measure Distance")
static function Init() {
var window = GetWindow(EditorGUILayoutVector2Field);
window.Show();
}
function OnGUI() {
p1 = EditorGUILayout.Vector2Field("Point 1:", p1);
p2 = EditorGUILayout.Vector2Field("Point 2:", p2);
EditorGUILayout.LabelField("Distance:", distance.ToString());
if(GUILayout.Button("Close"))
this.Close();
}
function OnInspectorUpdate() {
distance = Vector2.Distance(p1,p2);
this.Repaint();
}
}
最后修改:2011年7月14日 Thursday 16:45