Setting Up Virtual Cameras — Unity Cinemachine

Jack Leavey
2 min readJun 30, 2022

--

With Cinemachine installed, let’s take a look at the camera system.

Unity by default has the “Main Camera” Gameobject in every scene. You must have a main camera to use Cinemachine.

More specifically, your main camera needs a new component called the Cineamachine Brain.

Add a Cinemachine Brain

Why do you still need a default camera? Because Cinemachine uses virtual cameras, and the main camera is still the port to view the game with.

You can think of the virtual cameras as saved transforms and/or commands that, when trigged, will make the main camera go to that location and proceed with the commands if present.

How to add a new virtual camera.

I created two of these and set them in different locations.

When you look at the Inspector window on the vcams, near the top is the “Solo” button. Pressing this will force the game view window to show the selected camera’s point of view.

Using the “Solo button” swaps the view instantly.

The primary method of swapping cameras is by disabling the vcam gameobject. Look what happens when we do this instead:

Disabling vcams swaps them.

By default, we get a nice smooth transition to the new location. This transition can be edited or replaced (covered later).

Moving forward, we will look at how to aim the cameras and get those perfect shots!

--

--

Jack Leavey
Jack Leavey

Written by Jack Leavey

I am a software engineer with years of experience branching into game development, specifically in Unity. Follow along for guides on creating game mechanics!

No responses yet