So I am attempting to make a simple viewer in Unity. I am looking to have a vertical slider control the zoom of the camera and a horizontal camera control the rotation.
Currently I have the c# code to draw the vertical slider in the GUI layer and it controls the field of view. However, instead of the vSliderValue starting at 60 it starts at 0. So when I test the program I start off with a blank screen with a vertical slider bar. When I move the slider the camera will then jump to a value where i can see my scene.
Any thoughts as to why the camera wont start at 60?
Thanks.
public class Slider : MonoBehaviour {
public float vSliderValue = 60f;
void Update (){
checkCamZoom();
}
void OnGUI () {
vSliderValue = GUI.VerticalSlider (new Rect (25, 25, 10, (Screen.height-100)), vSliderValue, 80f, 40f);
}
void checkCamZoom (){
camera.fieldOfView = vSliderValue;
}
}