Follow The Player- Game Dev Series 101

Quick guide: use Cinemachine to create a camera following Player.

We have been used Cinemachine to create some cutscenes before. And also use it to follow the Player in 2.5D Platformer game.
We can also use it to follow Player in 2D game.

In this quick tutorial, we will create a Cinemachine to follow the Player.

Install Cinemachine

If your Unity version is 2019.04(as mine) or higher, you can install Cinemachine via Package Manager.

If you could not find Package Manager, you might need to install it from Asset Store.

Create Virtual Camera

Once installed Cinemachine, you can create a virtual camera from your drop down menu.
We will use this virtual camera as our default camera.

If you created a virtual camera, the origin main camera will no longer usable.

Select the virtual camera, there should have a column “Follow”. Drag your Player into that column. Now the camera would follow the Player.

If you want to adjust the distance of this camera, once you drag in Player to “follow” column, there should be a section called “Body” that would be able to adjust.
This is where you can make some changes to this virtual camera.

That is how to create a following camera.

--

--

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