title: Using slider to control Camera's FoV?
body: <p>I am using a slider and would like to control the camera's field of view. How can I achieve this since the slider is updated at every frame with Camera's field of view using Mouse Scroll? I want to control the slider as well as the slider should update FoV using Mouse scroll. Is there a way I can do both of this?</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  ublic class CamZoom : MonoBehaviour
  {
      float MouseZoomSpeed = 15.0f;
      float TouchZoomSpeed = 0.1f;
      float ZoomMinBound = 0.1f;
      float ZoomMaxBound = 120.9f;
      Camera cam;
  
      public Slider slider;
  
      // Use this for initialization
      void Start()
      {
          cam = GetComponent&lt;Camera&gt;();
      }
  
      
  void LateUpdate()
      {
  
           float scroll = -Input.GetAxis(&quot;Mouse ScrollWheel&quot;);
           Zoom(scroll, MouseZoomSpeed);
  
           slider.value = cam.fieldOfView;
         
  
           if(cam.fieldOfView &lt; ZoomMinBound) 
           {
               cam.fieldOfView = 0.1f;
           }
           else
           if(cam.fieldOfView &gt; ZoomMaxBound ) 
           {
               cam.fieldOfView = 179.9f;
           }
      }
  
      void Zoom(float deltaMagnitudeDiff, float speed)
      {
  
          cam.fieldOfView += deltaMagnitudeDiff * speed;
          // set min and max value of Clamp function upon your requirement
          cam.fieldOfView = Mathf.Clamp(cam.fieldOfView, ZoomMinBound, ZoomMaxBound);
      }
  }
  </code></pre>