EditorGUI.MinMaxSlider 最小最大滑动条


static function MinMaxSlider (label : GUIContent, position : Rect, ref minValue : float, ref maxValue : float, minLimit : float, maxLimit : float) : void
static function MinMaxSlider (position : Rect, ref minValue : float, ref maxValue : float, minLimit : float, maxLimit : float) : void

Parameters参数

  • label
    Optional label in front of the slider.
       最小最大滑条
  • position
    Rectangle on the screen to use for the slider.
    屏幕上用于滑杆的矩形区域    
  • value
    The value the slider shows. This determines the position of the draggable thumb.
    滑杆显示的值。决定滑块的位置。    
  • minValue
    The lower value of the range the slider shows, passed by reference.
    滑块的底值,通过引用传递。    
  • maxValue
    The upper value at the range the slider shows, passed by reference.
    滑块的高值,通过引用传递。    
  • minLimit
    The limit at the left end of the slider.
    滑杆左侧最小值    
  • maxLimit
    The limit at the right end of the slider.
    滑杆右侧最大值    

Description描述

Make a special slider the user can use to specify a range between a min and a max.

制作一个特殊的滑杆,用户可以指定滑块值的范围。

EditorGUI.MinMaxSlider 最小最大滑动条

MinMax Slider in an Editor Window.
编辑器中的最小最大滑条。

// Place the selected object randomly between the interval of the Min Max Slider// in the X,Y,Z coords//随机放置选择的物体在x,y,z最小最大化值之间class EditorGUIMinMaxSlider extends EditorWindow {var minVal : float = -10;var minLimit : float = -20;var maxVal : float = 10;var maxLimit : float = 20;@MenuItem("Examples/Editor GUI Move Object Randomly")static function Init() {var window = GetWindow(EditorGUIMinMaxSlider);window.Show();}function OnGUI() {EditorGUI.MinMaxSlider(GUIContent("Random range:"),Rect(0,0,position.width,20),minVal, maxVal,minLimit, maxLimit);if(GUI.Button(Rect(0,25,position.width, position.height -25),"Randomize!"))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.");}}


,