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参数

  • label
    Optional label in front of the toggle. // 开关按钮前面的可选标签。
  • value
    The value to edit. // 编辑的值
  • leftValue
    The value at the left end of the slider.
       滑动条最左边的值
  • rightValue
    The value at the right end of the slider.
       滑动条最右边的值
  • minLimit
    The limit at the left end of the slider.
       限制滑动条最左边的值
  • maxLimit
    The limit at the right end of the slider.
       限制滑动条最右边的值
  • options
    An 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.

制作一个特殊滑动条,用户可以使用指定的范围,在最小和最大值之间。

EditorGUILayout.MinMaxSlider 最小最大滑动条

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));elseDebug.LogError("Select a GameObject to randomize its position.");}}


,