- Home /
Question by
gazza529 · May 30, 2013 at 03:32 PM ·
cameraguisliderfieldofview
field of view slider starting point
hi all sorry for sucha simple question but all the tweaking doesn't seem to solve it. i have aGUI slider attached to the camera field of view to zoom in and out unforuntaely it always jumps to 15 which is the closest i want when i want it to start at the default position which is 60. HELP PLEASE.
pragma strict
ar hSliderValue : float = 60.0;
function OnGUI ()
{
hSliderValue = GUI.HorizontalSlider (Rect (400, 100, 100, 30), hSliderValue, 60.0, 15.0);
}
function Update ()
{
Camera.main.fieldOfView = hSliderValue;
}
Comment
Best Answer
Answer by robertbu · May 30, 2013 at 03:55 PM
When the game is not running, check the value of hSliderValue in the Inspector. The script value above is only used at the time the script is attached to the game object. Later changes must be done in the inspector. Alternately you can make the variable private:
private var hSliderValue : float = 60.0;