GUI.HorizontalSlider not working

var soundVolume: float = 0.0;
if(opMenuOpen == true){
GUI.Box(new Rect (halfScreenWidth - 200,halfScreenHeight - 150,400,300), “Options”);
soundVolume = GUI.HorizontalSlider (Rect (25, 25, 100, 30), soundVolume, 0.0, 100);
}

When i play it the slider doesnt move. I want it so i can control the volume.

Are you setting soundVolume=0 all the time? Your code looks like it. You should move that line somewhere out of your editor code loop

It seems, all code is written correctly (it is made on unity help as I see). Possible error if the last value isn’t float. Try:

 soundVolume = GUI.HorizontalSlider (Rect (25, 25, 100, 30), soundVolume, 0.0, 100.0);

I replaced your value 100 with value 100.0 (everything works for me though I write on CSharp). And remove your variable soundVolume from OnGUI function, and paste them as global variable.