GUI.HorizontalSlider is not working?

Hi I am using the following code to create horizontal Slider

var SiderValue : float = 50.0;
function OnGUI()
{
SiderValue = GUI.HorizontalSlider(Rect(200, 300, 200, 10), SiderValue, 0.0, 100.0);
}

But on run time I am unable to move the slider to left and right.

any thing i am doing wrong?

thanks in advance

I don’t see any obvious problems with your code (other than that ‘SliderValue’ is misspelled, which of course doesn’t matter here :slight_smile:

When you say ‘on run time’, are you referring to running the game in the editor, or as a standalone? Also, do other controls work correctly? What about VerticalSlider()?

just make sure the line

var SiderValue : float = 50.0;

is outside of the onGui, Update and LateUpdate functions or it will reset itself to 50 every frame! (I did that earlier today… duh)

guys sorry for late reply

@Vimalakirti you are right I created this variable on Top and was updating it in Update() (I was unintentionally thinking it to be Start() function)

@Jesse i was running in editor

thanks for reply