Set up your camera
Tutorial
·
Beginner
·
+10XP
·
30 mins
·
(36)
Unity Technologies

In this tutorial, you’ll set up the camera for your scene and apply post-processing effects to enhance the visual aesthetic.
1. Overview
In this tutorial, you’ll learn how to set up a dynamic camera system that enhances your game’s visual quality and player immersion. Cameras are crucial in defining the player's experience. Unity’s Cinemachine package offers a powerful and flexible way to manage cameras without writing custom scripts: it allows you to easily follow, look at, or orbit around targets. You’ll also explore how to enhance your camera with visual effects using Post-processing effects, such as color grading and vignettes, to give your game a unique aesthetic.
By the end of this tutorial, you’ll have a fully functional camera setup that looks great and feels just right for your gameplay.
2. Create a virtual camera/Cinemachine
Cinemachine is a powerful Unity package that simplifies camera control by offering pre-built camera types and behaviors. For this project, you’ll use one of these features, the Follow Camera: a camera that automatically tracks a target, typically the player character, from a fixed angle and distance. This saves you from having to script camera movement manually and ensures smooth, responsive gameplay visuals.
1. Create the Follow Camera:
- Right click in the Hierarchy window, and select Cinemachine > Targeted Camera > Follow Camera.
- Rename the new camera “Follow Camera”.
2. Inspect the Main Camera:
- Select the Main Camera GameObject in the Hierarchy window.
- Notice that it now has a Cinemachine Brain component.
Note: The Cinemachine Brain component acts as a controller that blends between virtual cameras like the Follow Camera. This component is what allows the Main Camera GameObject follow instructions from any Cinemachine camera. The Live Camera property shows which virtual camera is currently controlling the view; this should now be the Follow Camera.
3. Preview the Follow Camera setup:
- Select the Follow Camera GameObject in the Hierarchy window.
- In the Inspector window, you’ll see new components you might not have encountered before; these define the behavior of this camera type.
Note: You might see some warning signs indicating that certain values are missing. Don’t worry, we’ll assign them in the next step.
In the next step, you’ll configure the settings of the Follow Camera GameObject to make it follow the player character.
3. Change the Cinemachine settings
As mentioned in the previous step, adding the Follow Camera GameObject to your scene also added some essential components that define how the camera behaves. This type of camera keeps the target centered and allows it to rotate around the player character, as if the player character is in the center of a sphere. It can also follow the player character from any defined position.
There are three main components that control this behavior:
- Cinemachine Camera: This is the core component that every Cinemachine camera uses. It also allows you to assign a target (the GameObject the camera follows).
- Cinemachine Follow: This defines the position of the camera in relation to the target, using an offset. You can position it above, behind, or beside the player character based on these values.
- Cinemachine Rotation Composer: This controls how the camera rotates to keep the player character in view. You can set boundaries like the dead zone (an area where the target can move without moving the camera), and adjust how much the camera tilts or shifts while tracking the player character.
1. Assign the target:
- Select the Follow Camera in the Hierarchy window.
- In the Inspector window, in the Cinemachine Camera component, locate the Tracking Target property.
- Drag the Player GameObject from the Hierarchy window into the Tracking Target property box.
2. Adjust the camera position:
- In the Cinemachine Follow component, set the Follow Offset values to: Y = 4.1 and Z = -2.1.
Note: Leave the X value at 0. Changing this value would make the camera follow the Player GameObject from an angle instead of staying directly behind it.
3. Adjust the camera rotation:
- In the Cinemachine Rotation Composer component:
- Set Screen Position Y to 0.2 to place the player character slightly lower on the screen.
- Enable the Dead Zone property.
- Set Dead Zone Size to X = 0.1 and Y = 0.1.
Note: The Dead Zone is a space around the player character where movement doesn’t immediately cause the camera to follow. This makes the camera feel smoother and less jittery.
4. Test the camera behavior:
- Enter Play mode and move around to see the camera behavior in action.
With these simple adjustments, your Follow Camera GameObject is now fully functional and works great for this kind of character movement. You might have noticed many other settings you didn't use; feel free to explore them to create your own camera style. If you're curious to learn more, check out Unity’s Cinemachine Documentation or the Creative Core Pathway: Cameras course.
In the next step, you’ll learn how to enhance your camera with visual effects using post-processing effects.
4. Add post-processing effects
Unity provides a number of post-processing and full-screen visual effects that can significantly enhance the appearance of your application with minimal setup. These effects can simulate physical camera and film properties, such as depth of field and bloom, or can be used to create highly stylized visuals for your scene.
In this step, you'll apply a post-processing profile to your scene using Unity’s post-processing volumes, enabling effects like color grading and vignette to contribute to a specific mood or atmosphere.
1. Create a new post-processing layer:
- In the Inspector window, open the Layer dropdown and select Add Layer…
- In User Layer 8, enter “Post-processing Volumes” to create a new layer.
- This layer hasn’t been assigned to any GameObjects. You’ll assign this to the correct GameObjects shortly.
Note: We’ve used Layer 8 in this example so that there's space between this layer and the UI layer. This gives flexibility in case you want to add other layers later that need to render between the UI layer and the post-processing volumes layer.
2. Add a post-processing volume to the scene:
- In the Hierarchy window, right-click and select Volume > Global Volume.
- Rename the new Global Volume “Global post-processing”.
- Reset its Transform component’s Position property to X = 0, Y = 0, and Z = 0.
- Set its Layer to Post-processing Volumes.
3. Assign a post-processing profile:
- In the Volume component, find the Volume Profile property.
- Select the Volume Profile picker (⊙) and select the Scary Volume Profile.
Note: A Volume Profile is an asset that stores a group of visual effects and their settings, like contrast, saturation, color filters, and more. The Scary Volume Profile has already been set to give a spooky atmosphere.
4. Enable post-processing on the camera:
- Select the Main Camera GameObject.
- In the Inspector window, under the Camera component:
- Use the foldout (triangle) to expand the Rendering section and enable Post Processing.
- Use the foldout (triangle) to expand the Environment section, and in the Volume Mask property, enable Post-processing volume and disable Default.
You should see both the Scene and Game view immediately reflect the new post-processing effects.
If you want to explore more possibilities or learn about advanced post-processing setups, check out Unity’s Post-processing documentation or continue with the Creative Core Pathway: Post-processing course.
5. Next steps
With these steps completed, you’ve added a camera and implemented post-processing effects, and your game now feels more immersive.
In the next tutorial, you’ll set up the first enemies you’ll need to avoid in the game.