Third-person camera controller - part 2

Let's write a script for your camera which will follow our main character as it walks. The camera will also be able to zoom in and zoom out.

  1. Let's now make a C# script for our camera to follow the character as it moves. Go to the Script folder in the project window, right-click and select Create > C# Script and name it CameraController.

  2. Copy and paste this code into the CameraController.cs file.

Code Explanation:

The script is for your camera which will follow our main character as it walks. The camera will also be able to zoom in and zoom out.

Start: