EditorGUI
- actionKey
- BoundsField
- ColorField
- CurveField
- DrawPreviewTexture
- DrawTextureAlpha
- DropShadowLabel
- EnumPopup
- FloatField
- Foldout
- indentLevel
- InspectorTitlebar
- IntField
- IntPopup
- IntSlider
- LabelField
- LayerField
- MinMaxSlider
- ObjectField
- PasswordField
- Popup
- PrefixLabel
- ProgressBar
- PropertyField
- RectField
- SelectableLabel
- Slider
- TagField
- TextArea
- TextField
- Toggle
- Vector2Field
- Vector3Field
- Vector4Field
EditorGUI.BoundsField 边界盒字段
static function BoundsField (position : Rect, value : Bounds) : Bounds
static function BoundsField (position : Rect, label : GUIContent, value : Bounds) : Bounds
Parameters参数
- positionRectangle on the screen to use for the field.
屏幕上的矩形区域 - labelOptional label to display above the field.
该字段上面显示的可选标签 - valueThe value to edit. // 编辑的值
Bounds - The value entered by the user.
返回Bounds - 用户输入的值。
Description描述
Make Center & Extents field for entering a Bounds.
制作Center 和 Extents字段,用来输入一个Bounds。
Bounds field in an Editor Window.
在编辑器窗口中的边界盒字段。
// Simple script that shows radius of bounds of selected MeshFilter
//显示选择的MeshFilter的边界盒半径
class EditorGUILayoutBoundsField extends EditorWindow {
var radius : float = 0;
var bounds : Bounds;
@MenuItem("Examples/Show Radius of mesh bounds")
static function Init() {
var window = GetWindow(EditorGUILayoutBoundsField);
window.Show();
}
function OnGUI() {
GUILayout.Label("Select a mesh in the Hierarchy view and click 'Capture Bounds'");
EditorGUILayout.BeginHorizontal();
bounds = EditorGUILayout.BoundsField("Mesh bounds:", bounds);
if(GUILayout.Button("Capture Bounds") && Selection.activeTransform)
{
var meshFilter : MeshFilter = Selection.activeTransform.GetComponentInChildren(MeshFilter);
if (meshFilter)
bounds = meshFilter.sharedMesh.bounds;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField("Radius:", bounds.size.magnitude.ToString());
if(GUILayout.Button("Close"))
this.Close();
}
}
最后修改:2011年10月4日 Tuesday 10:09