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
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.
制作一个滑杆,用户可以在滑杆上拖动滑块,在最大和最小值之间任意改变。
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
Description描述
Make a slider the user can drag to change a value between a min and a max.
制作一个滑杆,用户可以在滑杆上拖动滑块,在最大和最小值之间任意改变。