- Home /
Sliding GUI.HorizontalSlider also moves Camera with FreeCamera script
I have a GUi.HorizontalSlider in my scene and have a camera with a FreeCamera script attached. This causes the problem that when I slide the HorizontalSlider, the camera also rotates according to the slider mouse movement.
How can I slide the GUI.HorizontalSlider without making the camera rotate?
var vSliderValue = 0.0F;
var R : Transform;
var L : Transform;
function OnGUI () {
vSliderValue = GUI.HorizontalSlider(new Rect(25, 25, 150, 150), vSliderValue, 0.0F, -180.0F);
R.transform.rotation.eulerAngles.y = vSliderValue;
}
Thanks
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613114525im_/https://answers.unity.com/themes/thub/images/avi.jpg)