Cinemachine: Switching Cameras

Gabriel Perez
2 min readMar 7, 2022

--

Want to know how to switch virtual cameras?

Two Ways

There are two ways to switch virtual cameras:

  • Disabling Virtual Cameras
  • Setting priorities to Virtual Cameras

Disabling Virtual Cameras

When multiple virtual cameras are in a scene, you can deactivate the active virtual camera to switch to another.

Disabling VCAM1 game object.

When I disable the virtual camera 1 game object in my Hierarchy, the cinemachine brain component will automatically find the next virtual camera, which is “VCAM2.”

The transition between VCAM1 to VCAM2.

Cinemachine’s algorithm knows what to do. It transitions from one camera to another. If we want to control which camera to transition to, we need to set priorities.

Priorities in Virtual Cameras

You can set the priority of a virtual camera by changing its priority value. When a virtual camera has a higher priority, the cinemachine brain component, in the Unity Camera, will activate the next virtual camera with the highest priority.

changing priorities.

If I change the priority of a virtual camera and it’s higher than the other cameras, the cinemachine brain component will tell the Unity Camera to switch to the highest priority value.

By changing the second camera’s priority value higher than the first camera, the cinemachine brain switches to the second camera.

That pretty much sums it! It’s easy and does not require coding. In my next post, I will write about how to make an interactive camera using Cinemachine and C#.

Gabriel

--

--

Gabriel Perez

Hello everyone, My name is Gabriel Perez, I am a Unity Developer and a creator who is always learning and experimenting.