static function HorizontalSlider (position : Rect, value : float, leftValue : float, rightValue : float) : float
static function HorizontalSlider (position : Rect, value : float, leftValue : float, rightValue : float, slider : GUIStyle, thumb : GUIStyle) : float
float - The value that has been set by the user.
返回float类型,已被用户设置的值。
Description描述
A horizontal slider the user can drag to change a value between a min and a max.
水平滑动条,用户能拖动改变最小和最大值之间。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float hSliderValue = 0.0F;
void OnGUI() {
hSliderValue = GUI.HorizontalSlider(new Rect(25, 25, 100, 30), hSliderValue, 0.0F, 10.0F);
}
}
// Draws a horizontal slider control that goes from 0 to 10.
//绘制一个从0-10的水平滑动条控件
var hSliderValue : float = 0.0;
function OnGUI () {
hSliderValue = GUI.HorizontalSlider(Rect (25, 25, 100, 30), hSliderValue, 0.0, 10.0);
}