【Unity】Getting Started with Unity Cinemachine: Cinematic Camera Work Without Scripting

Created: 2026-02-05

Learn how to use Cinemachine, Unity's official camera control package. Achieve high-quality camera work including Virtual Cameras, camera shake, and obstacle avoidance without writing any scripts.

Overview

"I want the camera to follow my character..." "I want to smoothly switch between multiple cameras..." "I want to implement camera shake..."

This is where Cinemachine comes in. Cinemachine is Unity's official package for camera control. It enables high-quality camera work without writing any scripts.

Tested with: Unity 2022.3 LTS / Unity 6, Cinemachine 3.x

Version note: This article covers Cinemachine 3.x. Component names and APIs differ in Cinemachine 2.x (e.g., CinemachineVirtualCamera has become CinemachineCamera). Please check your project's version.

Installation

Cinemachine can be installed from the Package Manager.

  1. From the Unity Editor menu, select "Window" > "Package Manager"
  2. Select "Unity Registry" from the dropdown menu in the upper left
  3. Find "Cinemachine" in the list and click on it
  4. Click the "Install" button in the lower right

Core Concepts

Virtual Camera

A Virtual Camera is a virtual camera placed in the scene. It does not render anything itself; instead, it sends position and orientation data to the Main Camera's Cinemachine Brain.

A Virtual Camera consists of three main elements:

ElementDescription
BodyControls camera position (tracking, path movement, etc.)
AimControls camera direction (look-at, screen composition, etc.)
NoiseAdds camera shake and handheld effects

Cinemachine Brain

Cinemachine Brain is a component attached to the Main Camera. It manages all Virtual Cameras in the scene and determines which Virtual Camera should be active.

Virtual Camera Basics

Creating a Virtual Camera

  1. Right-click in the Hierarchy window
  2. Select "Cinemachine" > "Cinemachine Camera"

Setting Targets

TargetDescription
Tracking TargetThe target the camera follows (affects Body settings)
Look At TargetThe target the camera looks at (affects Aim settings)

Main Body Types

TypeUse Case
Do NothingFixed position
FollowFollow a target (for 3D games)
Position ComposerPosition the target at a specific screen location (for 2D games)
Orbital FollowOrbit around a target
Third Person FollowTPS-style over-the-shoulder camera
Spline DollyMove along a path

Third Person Follow (TPS Camera)

The most commonly used camera type in TPS games. It positions the camera over the player's shoulder with aiming support.

  1. Create a Cinemachine Camera
  2. Set Body to "Third Person Follow"
  3. Adjust parameters:
    • Shoulder Offset: Offset from the shoulder (e.g., 0.5, 0, 0 for over the right shoulder)
    • Camera Distance: Distance from the player
    • Damping: Smoothness of follow

Changes from Cinemachine 2.x: In 2.x, these were named Framing Transposer and Transposer, which have been renamed to Position Composer and Follow in 3.x.

Practical Examples

Example 1: Camera Following a Character

  1. Create a Cinemachine Camera
  2. Configure the following:
    • Tracking Target: The character's Transform
    • Look At Target: The character's Transform
    • Body: Follow
    • Follow Offset: (0, 2, -5)
    • Aim: Composer

Example 2: Smoothly Switching Between Multiple Cameras

using UnityEngine;
using Unity.Cinemachine;

public class CameraSwitcher : MonoBehaviour
{
    [SerializeField] private CinemachineCamera camera1;
    [SerializeField] private CinemachineCamera camera2;

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            camera1.Priority.Value = 15;
            camera2.Priority.Value = 5;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            camera1.Priority.Value = 5;
            camera2.Priority.Value = 15;
        }
    }
}

Example 3: Implementing Camera Shake

  1. Select the Virtual Camera
  2. Select "Add Extension" > "Cinemachine Basic Multi Channel Perlin"
  3. Set the Noise Profile (important):
    • Click the circle button to the right of the "Noise Profile" field
    • Select a preset like "6D Shake" (shake will not work without a Noise Profile)
  4. Set parameters:
    • Amplitude Gain: 1.0 (intensity)
    • Frequency Gain: 1.0 (frequency)

Important: Without a Noise Profile set, changing Amplitude or Frequency will have no effect. Use one of Unity's built-in presets like "6D Shake" or "Handheld_normal_mild", or create your own NoiseSettings asset.

using UnityEngine;
using Unity.Cinemachine;

public class CameraShake : MonoBehaviour
{
    [SerializeField] private CinemachineCamera virtualCamera;
    private CinemachineBasicMultiChannelPerlin noise;

    void Awake()
    {
        // Get the noise component from the extension
        noise = virtualCamera.GetComponent<CinemachineBasicMultiChannelPerlin>();
    }

    public void Shake(float amplitude, float frequency, float duration)
    {
        if (noise == null) return;

        noise.AmplitudeGain = amplitude;
        noise.FrequencyGain = frequency;
        Invoke(nameof(StopShake), duration);
    }

    void StopShake()
    {
        noise.AmplitudeGain = 0f;
        noise.FrequencyGain = 0f;
    }
}

Example 4: Camera Obstacle Avoidance

  1. Select the Virtual Camera
  2. Select "Add Extension" > "Cinemachine Deoccluder"
  3. Set the obstacle layers in "Collide Against"

Input System Integration

To implement player-driven camera rotation with Orbital Follow or Third Person Follow, use CinemachineInputAxisController.

Setup Steps

  1. Add "Add Component" > "Cinemachine Input Axis Controller" to the Virtual Camera
  2. Create an Input Actions asset and set up a Look (Vector2) action
  3. Assign it to the CinemachineInputAxisController's "Input Action"

Code Example (When Controlling via Script)

using UnityEngine;
using UnityEngine.InputSystem;
using Unity.Cinemachine;

public class CameraLookController : MonoBehaviour
{
    [SerializeField] private CinemachineCamera virtualCamera;
    [SerializeField] private InputActionReference lookAction;

    private CinemachineOrbitalFollow orbitalFollow;

    void Awake()
    {
        orbitalFollow = virtualCamera.GetComponent<CinemachineOrbitalFollow>();
    }

    void OnEnable() => lookAction.action.Enable();
    void OnDisable() => lookAction.action.Disable();

    void Update()
    {
        Vector2 lookInput = lookAction.action.ReadValue<Vector2>();
        // Update the horizontal rotation of Orbital Follow
        orbitalFollow.HorizontalAxis.Value += lookInput.x * Time.deltaTime * 100f;
    }
}

Note: When using the New Input System, make sure to enable the Input System Package in Project Settings.

Extensions

ExtensionUse Case
Cinemachine DeoccluderMove the camera to avoid obstacles
Cinemachine Basic Multi Channel PerlinContinuous camera shake (handheld, vibration)
Cinemachine Impulse SourceMomentary camera shake (explosions, hits)
Cinemachine Follow ZoomAdjust FOV based on distance
Cinemachine Confiner 2D/3DRestrict camera to a defined area

Impulse Source (Momentary Shake)

The Impulse System is ideal for momentary camera shake on explosions or damage.

using UnityEngine;
using Unity.Cinemachine;

public class ExplosionShake : MonoBehaviour
{
    [SerializeField] private CinemachineImpulseSource impulseSource;

    public void Explode()
    {
        // Generate impulse from the explosion position
        impulseSource.GenerateImpulse();
    }
}
  1. Add "Cinemachine Impulse Source" to an empty GameObject
  2. Add "Cinemachine Impulse Listener" to the Virtual Camera
  3. Call GenerateImpulse() from a script

Timeline Integration

Combining Cinemachine with Timeline makes it easy to create cutscenes and event sequences.

  1. Open the Timeline window (Window > Sequencing > Timeline)
  2. Add a Cinemachine Track to the Timeline
  3. Drag and drop multiple Virtual Cameras onto the Cinemachine Track
  4. Adjust the placement and duration of each Virtual Camera

Best Practices

  • Use consistent naming for Virtual Cameras - e.g., "VCam_Follow", "VCam_Boss"
  • Set Priority values strategically - Use increments of 10 to leave room for inserting new cameras
  • Adjust Damping for smoothness - Use smaller values for action games, larger values for adventure games
  • Tune Blend Time - Typically 1-2 seconds feels natural
  • Leverage Extensions - Obstacle avoidance, camera shake, area confinement, and more

Summary

Cinemachine is a powerful tool for controlling cameras in Unity.

  • Implement camera work without scripting - Just configure settings in the Inspector
  • Automatically adapts to animation and terrain changes - No manual adjustments needed
  • Achieve high-quality camera work quickly - Follow, switch, shake, obstacle avoidance
  • Create cinematic sequences with Timeline integration - Cutscenes and event sequences

Start using Cinemachine to create cinematic camera work in your projects.

Further Learning