unity3D之GUI之Slider控件用法

Slider控件由滑块滑动条组成,可用作调声音,或者调颜色。

#pragma strict

var verticalValue:int;
var horizontalValue:int;

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+"%");
}

你可能感兴趣的:(unity3D之GUI之Slider控件用法)