Cinemachine and Group Targets in Unity

Objective: To learn how to keep multiple targets in the frame.

Group Composer Aim Setting

Cinemachine is absolutely fantastic with being able to keep a single target in the frame, but is it able to do this with multiple targets? Let’s take a look at a ‘Group Composer’ feature in the ‘Aimsettings.

What is the Group Target ‘Aim’ Setting in Cinemachine?

This setting is Cinemachines way of saying let’s take a bunch of individual targets and treat them as if it was 1 ‘LookAt’ target.

Let’s Get This Virtual Camera Setup

To start let’s add the virtual camera to the scene, ‘Cinemachine’ tab → ‘Create Virtual Camera’. This will now be added as a game object in your scene.

Adding a new virtual camera to a scene

Next we are going to create the ‘TargetGroupgame object and add a CinemachineTargetGroup component to it. Create Empty Game Object in Hierarchy → Rename to ‘TargetGroup’ → Add component in the Inspector ‘CinemachineTargetGroup’:

Creating a TargetGroup and also adding the CinemachineTargetGroup component

Now let’s change the ‘Aimsetting in the CinemachineVirtualCamera component in the Inspector and also add the newly created ‘TargetGroup’ to the ‘LookAt’ field:

Updating the Aim settings to be ‘Group Composer’ and adding TargetGroup game object to the ‘LookAt’ field

You might be met this small error, which is perfectly fine. It is basically letting us know that there is no group targets added to the component yet. So let’s add some!

But first, we need to add a couple cubes to either side of the capsule so that we have multiple targets:

Now, let’s add these targets to the CinemachineGroupTarget component on the ‘TargetGroupgame object:

Adding targets to the CinemachineGroupTarget component

On your Game view tab, you may now see these yellow lines across the screen which is going to help us track multiple targets to be in the same frame:

Yellow Lines in Game view tab

Let’s Test It!

It is time to see if our magic has paid off. We are hoping to see that when we move the capsule back and forth, the virtual camera will automatically adjust itself to make sure that all the targets are in the same frame:

Success!! That was super easy to setup and we haven’t even begun to play around with all the additional settings available to us in the ‘Aimsettings and also the ‘CinemachineTargetGroup’ component:

Group Composer Aim settings
CinemachineTargetGroup component settings




Passionate Unity Game Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Take a Memo

Not a Coder? No Problem: Concrete Advice for Non-Technical Founders

Code-Wars Kata Coding Challenge — “Stop gninnipS My sdroW!”

Right Sizing for AWS RDS Instances

AnySwap New User Interface — All In One

Simple Display of Open Source License Info?

How to install Xdebug on Ubuntu Effortlessly

Convert Python Script to EXE file

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
Chris Hilton

Chris Hilton

Passionate Unity Game Developer

More from Medium

Making a Treasure Chest System Using Timeline in Unity

IK Weapon System in Unity

Loading Scenes In Unity

OnClick Event in Unity