- Home /
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.
Answer by HappyMoo · Jan 08, 2014 at 07:49 AM
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
Answer by zharik86 · Jan 08, 2014 at 07:47 AM
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.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How To Make GUI Buttons Load/Quit 1 Answer
How to make GUI Text Bigger? 1 Answer
animated sword + script 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers