EditorGUI.Slider 滑动条


static function Slider (position : Rect, value : float, leftValue : float, rightValue : float) : floatf
static function Slider (position : Rect, label : string, value : float, leftValue : float, rightValue : float) : float
static function Slider (position : Rect, label : GUIContent, value : float, leftValue : float, rightValue : float) : float

Parameters参数

  • position
    Rectangle on the screen to use for the slider.
    屏幕上用于滑杆的矩形区域    
  • label
    Optional label in front of the slider.
    显示在滑杆前面的可选择标签    
  • value
    The value the slider shows. This determines the position of the draggable thumb.
    显示的滑杆值,决定滑块的位置    
  • leftValue
    The value at the left end of the slider.
    滑杆左端的值    
  • rightValue
    The value at the right end of the slider.
    滑杆右端的值    

Returns

float - The value that has been set by the user.

返回浮点数 - 用户设置的值。

Description描述

Make a slider the user can drag to change a value between a min and a max.

制作一个滑杆,用户可以在滑杆上拖动滑块,在最大和最小值之间任意改变。

EditorGUI.Slider 滑动条

Slider in an Editor Window.
在编辑器窗口中的滑动条。

// Editor script that lets you scale the selected GameObject between 1 and 100//编辑器脚本 ,让你对被选择的对象在1到100之间取值class EditorGUISlider extends EditorWindow {var scale : float = 1.0;@MenuItem("Examples/EditorGUI Slider usage")static function Init() {var window = GetWindow(EditorGUISlider);window.position = Rect(0,0,150,30);window.Show();}function OnGUI() {scale = EditorGUI.Slider(Rect(5,5,150,20),scale,1, 100);}function OnInspectorUpdate() {if(Selection.activeTransform)Selection.activeTransform.localScale = Vector3(scale, scale, scale);}}

static function Slider (position : Rect, property : SerializedProperty, leftValue : float, rightValue : float) : void
static function Slider (position : Rect, property : SerializedProperty, leftValue : float, rightValue : float, label : string) : void
static function Slider (position : Rect, property : SerializedProperty, leftValue : float, rightValue : float, label : GUIContent) : void

Parameters参数

  • position
    Rectangle on the screen to use for the slider.
       屏幕上用于滑杆的矩形区域
  • label
    Optional label in front of the slider.
       滑杆前方的可选标签
  • property
    The value the slider shows. This determines the position of the draggable thumb.
       滑块显示的值。这个定义可拖动滑块的位置。    
  • leftValue
    The value at the left end of the slider.
       滑杆左末端的值。
  • rightValue
    The value at the right end of the slider.
       滑杆右末端的值。

Description描述

Make a slider the user can drag to change a value between a min and a max.

制作一个滑杆,用户可以在滑杆上拖动滑块,在最大和最小值之间任意改变。


,