- Home /
Problem with the position of VerticalSlider
Hi, I got a Problem to position my VerticalSlider in the correct space. it goes straight 2 the upper left corner, but should have the same position as my menuBox.
Any ideas? Plz Help
var vSliderValue = 50.0; var HochwasserMenuFont : Font; private var HochwasserEnabled = false;
function Start(){ HochwasserEnabled = false; Time.timeScale = 1; AudioListener.volume = 1; Screen.showCursor = false; }
function Update(){
//check if pause button (p) is pressed if(Input.GetKeyDown("p")){ //check if game is already paused if(HochwasserEnabled == true){ //unpause the game HochwasserEnabled = false; Time.timeScale = 1; AudioListener.volume = 1; Screen.showCursor = false; GetComponent(MouseLook).enabled = true; } //else if game isn't paused, then pause it else if(HochwasserEnabled == false){ HochwasserEnabled = true; AudioListener.volume = 0; Time.timeScale = 0; Screen.showCursor = true; GetComponent(MouseLook).enabled = false; } }
GameObject.Find("freies HW").transform.position.y = vSliderValue;
}
function OnGUI(){
GUI.skin.box.font = HochwasserMenuFont; GUI.skin.button.font = HochwasserMenuFont;
if(HochwasserEnabled == true){ //Make a background boxpp GUI.Box(Rect(150,200,100,300), "Hochwasser"); } if(GUILayout.VerticalSlider(-150,-200,-100)){ Application.vSliderValue = GUILayout.VerticalSlider (vSliderValue, 90.0, 50.0); ; } }
Your answer
![](https://koobas.hobune.stream/wayback/20220613084253im_/https://answers.unity.com/themes/thub/images/avi.jpg)