How to Make a Interactive Camera using Cinemachine and C#

Here’s an easy way to add an interactive zoom to your Virtual Camera in Unity by ‘using Cinemachine’ GetComponent<CinemachineVirtualCamera>().m_Lens.FieldOfView.

Here we have a simple scene that includes a Virtual Camera, a Plane, an animated Cube and a Sphere:

Adding this script will allow us to update the Field Of View on the Virtual Camera:

And here is the result:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store