//纵向滑动条数值 var verticalValue : int = 0;
//横向滑动条数值 var horizontalValue : float = 0.0f;
function OnGUI () {
//计算滑动进度
verticalValue = GUI.VerticalSlider (Rect (25, 25, 30, 100), verticalValue, 100, 0);
horizontalValue = GUI.HorizontalSlider(Rect (50, 25, 100, 30), horizontalValue, 0.0f, 100.0f);
//将滑动进度显示在屏幕中
GUI.Label(Rect(10, 150, Screen.width, 30), "纵向滑动条当前进度: " + verticalValue +"%");
GUI.Label(Rect(10, 180, Screen.width, 30), "横向滑动条当前进度: " + horizontalValue +"%");
}
//滚动条位置
var scrollPosition : Vector2;
function Start()
{
//初始化滚动条位置
scrollPosition[0] = 50;
scrollPosition[1] = 50;
}
function OnGUI () {
//设置开始滚动视图
scrollPosition = GUI.BeginScrollView (Rect (0,0,200,200),scrollPosition, Rect (0, 0, Screen.width, 300),true,true);
GUI.Label(Rect(100, 40, Screen.width, 30), "测试滚动视图,测试滚动视图,测试滚动视图,测试滚动视图。");
//设置结束滚动视图
GUI.EndScrollView ();
}