2D Cameras in Unity Using Cinemachines Virtual Camera

Objective: To understand Cinemachines 2D camera and help get your next project setup.

Cinemachine 2D Camera

How to Add a 2D Virtual Camera to Your Scene

This is a nice easy process! Make sure you have the Cinemachine package installed from Unity’s Package Manager, look along the top tabs for ‘Cinemachine’ → ‘Create 2D Camera’.

How to Get the Right Setup for Your Project

When you add the 2D camera into your scene, you will notice that it looks like other virtual cameras and really nothing has changed. This is because we need to take a few more steps to get this functioning (as I am in a 3D project):

2D Camera created in the Scene view
2D Virtual Camera Settings in Inspector
  1. Assign a ‘Followtarget to the field. E.g. Mine was the capsule
    Leave the ‘LookAt field blank.
  2. Set the ‘Field of View’ under the ‘Lenssetting to 1.
  3. Navigate (or move/adjust) the camera around the scene until you like to position it is in. Then make sure to set this position by going up to the top tabs and selecting ‘Game Object’ → ‘Align with View’ or alternatively pressing Ctrl + Shift + F.
  4. Now just adjust the ‘Camera Distance’ to whatever you like! I personally set mine to 500.
  5. Finally, you could change your Main CamerasProjectionmode to ‘Orthographic’.

This is the final changes:

2D Virtual Camera Settings
Game view — Without Orthographic perspective
With Orthographic perspective

Success! The 2D camera works!



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