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.MinMaxSlider 最小最大滑动条
static function MinMaxSlider (ref minValue : float, ref maxValue : float, minLimit : float, maxLimit : float, params options : GUILayoutOption[]) : void
static function MinMaxSlider (label : GUIContent, ref minValue : float, ref maxValue : float, minLimit : float, maxLimit : float, params options : GUILayoutOption[]) : void
Parameters参数
-
labelOptional label in front of the toggle. // 开关按钮前面的可选标签。
-
valueThe value to edit. // 编辑的值
- leftValueThe value at the left end of the slider.
滑动条最左边的值 - rightValueThe value at the right end of the slider.
滑动条最右边的值 - minLimitThe limit at the left end of the slider.
限制滑动条最左边的值 -
maxLimitThe limit at the right end of the slider.
限制滑动条最右边的值 -
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
指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。
Description描述
Make a special slider the user can use to specify a range between a min and a max.
制作一个特殊滑动条,用户可以使用指定的范围,在最小和最大值之间。
Moves the selected object randomly betweeen the interval.
在间隔之间,随机移动选择的物体。
// Place the selected object randomly between the interval of the Min Max Slider
// in the X,Y,Z coords
//随机放置选择的物体在最小最大滑动条之间
class EditorGUILayoutMinMaxSlider extends EditorWindow {
var minVal : float = -10;
var minLimit : float = -20;
var maxVal : float = 10;
var maxLimit : float = 20;
@MenuItem("Examples/Place Object Randomly")
static function Init() {
var window = GetWindow(EditorGUILayoutMinMaxSlider);
window.Show();
}
function OnGUI() {
EditorGUILayout.LabelField("Min Val:", minVal.ToString());
EditorGUILayout.LabelField("Max Val:", maxVal.ToString());
EditorGUILayout.MinMaxSlider(minVal, maxVal, minLimit, maxLimit);
if(GUILayout.Button("Move!"))
PlaceRandomly();
}
function PlaceRandomly() {
if(Selection.activeTransform)
Selection.activeTransform.position =
Vector3(Random.Range(minVal, maxVal),
Random.Range(minVal, maxVal),
Random.Range(minVal, maxVal));
else
Debug.LogError("Select a GameObject to randomize its position.");
}
}
最后修改:2011年7月14日 Thursday 10:02