Getting started with Unity Camera

When it comes to game development, creating a compelling and immersive experience for players is paramount. One of the critical components of achieving this is through the use of Cameras. The Unity camera plays a vital role in rendering the game scene, creating a view of the game world that players can interact with in real-time. In this article, we will take an in-depth look at Unity Camera component and explore its different capabilities.

Unity camera banner

What is a Camera in Unity

Unity Camera component is a fundamental element in game development that provides a view of the game world to the player. The camera component is responsible for rendering the game scene, including objects, characters, and environments, and presenting it to the player in real-time.

With Unity’s Camera component, developers can easily create a range of camera effects, such as depth of field, motion blur, and color grading, to enhance the visual quality of their game. Additionally, the camera component also plays a critical role in game design, as it can be used to create different gameplay mechanics, such as perspective puzzles, stealth games, and first-person shooters.

Unity Camera properties

Camera component in Unity Editor

Clear Flags

Clear Flags determine what to draw in the empty area of the scene. You can select from the 4 options of Skybox, Solid Color, Depth or Don’t clear.


The Camera will render the background color when there is no object to render. You should be able to see this color before the camera starts rendering.

Culling Mask

Culling Mask allows the camera to render or ignore game objects on particular layers. If you want the camera to ignore all game objects on the UI layer, then you can uncheck the UI layer from the drop down.


Projection is best understood as an image. Check out the images below

Perspective Camera View
Orthographic Camera View

Field of View

Field of View or FOV is something similar to zoom in the real-world camera. You can adjust the FOV using the slider provided. Unity also gives you a FOV axis option. You can set it to either vertical or horizontal.

The FOV option is replaced by size in case of an Orthographic Camera.

Clipping plane

A Clipping plane in Unity Camera is a boundary that determines which objects are visible within the camera’s view frustum (frustrum is a pyramid with the top cut off) and which ones are not.

Unity allows you to set the near plane and far plane options for the Camera frustum.


The depth parameter determines the order in which multiple cameras render the game scene. When there are multiple cameras in a scene, the depth parameter allows developers to specify which camera should be rendered first.

Viewport Rect

Viewport rect property is used to set the size of the camera view in your scene. The X and Y property can be used to set this. (0,0) represents the bottom left corner of the scene and (1,1) represents the top right corner of the scene.

Viewport Rect option in Unity Camera component

All the other options in the camera component are very case specific and we will discuss them in the required tutorials.

First person camera in Unity

You can position the Unity camera in different ways to get different view. To use the Camera as a first-person camera, follow the steps below

Set the Camera as the child of your player

Camera set as child of player

Set the position of the camera to where the head of your player will be

Camera set to first person view position

As the camera is a child of the player, it will move and turn along with the player. Your FPS controller should be enough to move the camera and the player.

Third person camera

As in case of the first-person Camera, you can make the camera a child of the player and set the view so that the player in visible on the camera view. This is the easiest way to make a third person camera. But there is one drawback with this. If you want to see the player jump or rotate then you will have to use a camera follow script and move the camera only in case of horizontal movement.

Camera Follow Player with Script

Set your camera as required by adjusting the transform in the editor. This will be your initial camera position. We will calculate the offset based on this in the script.

  • Create a new script by name Camera_Follow in the project window using create>new C# script.
  • Copy and paste the code below in the script.
  • Add the script to camera using add component button in the inspector window or drag and drop the script to the camera.
  • Drag and drop the player gameobject to the Camera_Follow script.
  • Run the game and the camera will follow the player.
using UnityEngine;
using System.Collections;

public class Camera_Follow : MonoBehaviour
public GameObject player;
private Vector3 offset;
private Vector3 newtrans;

void Start ()
    offset.x = transform.position.x - player.transform.position.x;
    offset.z = transform.position.z - player.transform.position.z;
//not taking y as we won't update y position. 

void LateUpdate ()
newtrans.x= player.transform.position.x + offset.x;
newtrans.z= player.transform.position.z + offset.z;
transform. Position = newtrans;


Using Cinemachine to create first person and third person Camera

With the release of Unity Cinemachine a lot of camera features have been inbuilt in the virtual camera. Let’s see how to make the camera follow the player using virtual Vcam in Cinemachine.

Step1: Install Unity Cinemachine

  1. Go to Windows>Package Manager.
  2. If you are using Unity 2021 then select Packages: Unity Registry. You can skip this step for older versions.
  3. Search Cinemachine and Install it.
Installing Cinemachine using Unity Package Manager

Step2: Add a virtual cam

  1. In older versions of Unity, you will see a Cinemachine option on the main menu. From Unity 2021 and above, this option is moved inside Gameobject menu.
  2. Adjust your scene view to the place where you want to add the camera.
  3. Go to Cinemachine>Virtual camera.
  4. This will add a Vcam to the scene and a Cinemachine brain to the main camera.
  5. We need only one Vcam for this purpose.

Step3: Assign the player to the Virtual Cam

  1. Select the Virtual camera in the Hierarchy window.
  2. Go to the inspector window and find the CinemachineVirtualCamera component.
  3. Drag and drop your player to the follow option in the CinemachineVirtualCamera component.
  4. In the body component select framing transposer.
  5. Reduce x, y, z damping in the body component to reduce the delay in follow.

Play the game and the camera will follow the player.

This method cannot be used if you have multiple virtual cams for making cutscenes.

Cinemachine virtual camera inspector settings

Using multiple cameras in One scene

You can have multiple cameras in your scene and render them together to present a combined view to the player. The most common example, is providing a simple overview on the top of the screen. Let’s see how to do it.

  1. Add a new Camera to the scene.
  2. Set the Camera view to orthographic.
  3. Set the position of the camera on top of the player and rotate the camera to look down on the player.
  4. Create a new layer called player and set the player to the player layer.
  5. Set the camera’s culling mask to render only player.
  6. Set the Viewport Rect value to X-0.75 and Y-0.75. This will set the camera to the top of the screen.

Here is how the output will look like

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

10 key points for a game trailer Why is UX important in Game design? Level Designer’s Role in Game development How to Use Game Analytics? 10 Tips for Designing Multi-Platform Games