Player Setup Part 9

Objective: Setup camera follow system

As you can see above, when the Player moves to the right, it goes off the screen and out of the cameras view. We need the camera to follow the Player. A quick and easy way although not the best option, is to make the camera a child object of the Player. A better approach would be to use Cinemachine.

To get started with Cinemachine, go to Window, Package Manager, then search for Cinemachine and install.

Now that Cinemachine is installed, there is a new tab in the Menu bar for Cinemachine. Go to Cinemachine, create a Virtual Camera and rename it to suit(CM Follow Cam). With the Virtual Camera selected, drag the Player from the hierarchy into the Follow option in the inspector.

The camera now follows the Player.