hello i have made a minimap for my game and ive got a vertical scroller so you can zoom in and out i was wondering how i would go about making a button that resets the camera.fieldofview and also resets the vertical slider this is probley easy but i am a noob and have tried everything i know. here is my code so far:
var fovMax : float = 180;
var fovMin : float = 1;
var sliderPos : Rect = Rect ( 10, 10, 300, 30 );
private var camFOV : float;
function Start () {
camFOV = camera.fieldOfView;
}
function OnGUI () {
camFOV = GUI.VerticalSlider( sliderPos, camFOV, fovMin, fovMax );
if(GUI.RepeatButton(Rect(Screen.width/2 -19 , Screen.height -50, 18, 18), "+")){
camera.fieldOfView = 21f;
}
}
function Update () {
if (!Mathf.Approximately (camFOV, camera.fieldOfView)) camera.fieldOfView = camFOV;
any help will be appreciated thankyou.