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.Vector3Field 三维向量字段
static function Vector3Field (label : string, value : Vector3, params options : GUILayoutOption[]) : Vector3
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
指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。
Vector3 - The value entered by the user.
返回Vector3,由用户输入的值。
Description描述
Make an X, Y & Z field for entering a Vector3.
制作X , Y & Z字段用于输入Vector3。
Measure the distance between 2 GameObjects or 2 positions in 3D space.
测量在3D空间两物体或两点之间的距离。
// Simple Script that measures the distance between 2 GameObjects
// or measure the distance between 2 positions in 3D space
//测量在3D空间两物体或两点之间的距离。
class EditorGUILayoutVector3Field extends EditorWindow {
var distance : float = 0;
var obj1 : Vector3;
var obj2 : Vector3;
@MenuItem("Examples/Measure Distance between 2 objects")
static function Init() {
var window = GetWindow(EditorGUILayoutVector3Field);
window.Show();
}
function OnGUI() {
GUILayout.Label("Select an object in the Hierarchy view and click 'Capture Position'");
EditorGUILayout.BeginHorizontal();
obj1 = EditorGUILayout.Vector3Field("GameObject 1:", obj1);
if(GUILayout.Button("Capture Position"))
obj1 = Selection.activeTransform.position;
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
obj2 = EditorGUILayout.Vector3Field("GameObject 2:", obj2);
if(GUILayout.Button("Capture Position"))
obj2 = Selection.activeTransform.position;
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField("Distance:", distance.ToString());
if(GUILayout.Button("Close"))
this.Close();
}
function OnInspectorUpdate() {
distance = Vector3.Distance(obj1,obj2);
this.Repaint();
}
}
最后修改:2011年7月14日 Thursday 16:58