Cinemachine: Switching Cameras
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.
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.”
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.
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.
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