ResetFieldOfView() instead of storing default in a variable

Not sure if there are any pitfalls with this approach, but seems to work fine:

   private Camera eyeCamera;

	void Start () {
        eyeCamera = GetComponent<Camera>();        
    }
	
	void Update () {
        if (Input.GetButtonDown("Zoom")) eyeCamera.fieldOfView = 2 * eyeCamera.fieldOfView / 3;
        if (Input.GetButtonUp("Zoom")) eyeCamera.ResetFieldOfView();
    }

Privacy & Terms