Camera stacks contain a single Base CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary with one or more Overlay Cameras stacked on top. In the Editor, you can add, remove, and reorder these cameras as much as you like to achieve the desired effects.
This page is split into the following sections:
To add a camera to a camera stack, use the following steps:
The Overlay Camera is now part of the Base Camera’s camera stack. Unity renders the Overlay Camera’s output on top of the Base Camera’s output.
Note: When you create multiple cameras for a camera stack, consider whether the cameras are all necessary. Each camera you add makes rendering slower, because an active camera runs through the entire rendering loop even if it renders nothing.
You can also add a camera to a camera stack with a C# script. Use the cameraStack
property of the Base Camera’s Universal Additional Camera Data component, as shown below:
var cameraData = camera.GetUniversalAdditionalCameraData();
cameraData.cameraStack.Add(myOverlayCamera);
To remove a camera from a camera stack, use the following steps:
The Overlay Camera remains in the scene, but is no longer part of the camera stack.
You can also remove a Camera from a camera stack with a C# script. Use the cameraStack
property of the Base Camera’s Universal Additional Camera Data component, as shown below:
var cameraData = camera.GetUniversalAdditionalCameraData();
cameraData.cameraStack.Remove(myOverlayCamera);
To reorder the cameras in a camera stack, use the following steps:
The Base Camera renders the base layer of the camera stack, and the Overlay Cameras in the stack render on top of this in the order that they are listed, from top to bottom.
You can also reorder a camera stack with a C# script. Use the cameraStack
property of the Base Camera’s Universal Additional Camera Data component. The cameraStack
is a List
and can be reordered in the same way as any other List
.