CameraComponent to render. Add it to a GameObject — the component uses the object’s world position and rotation to determine the camera’s view. Multiple cameras can coexist; IsMainCamera and Priority control which one the player sees.
CameraComponent is sealed. Extend camera behaviour by writing a separate component that reads or writes properties on the camera each frame.Projection properties
Horizontal (or vertical, depending on
FovAxis) field of view in degrees. Valid range is 1–179. Hidden when Orthographic is true.The axis along which
FieldOfView is measured. Horizontal fits the view within the x-axis; Vertical fits it within the y-axis.When
true, the camera uses orthographic projection instead of perspective. Useful for 2D games or UI previews.The height of the orthographic view in world units. Only applies when
Orthographic is true.Near clip plane distance. Objects closer than this are not rendered. Keep this above 1 to avoid depth-buffer artefacts such as z-fighting.
Far clip plane distance. Objects beyond this are not rendered. Balance against
ZNear — a larger ZNear lets you push ZFar further without precision loss.Camera selection
Marks this camera as the main game camera. The scene uses the active camera with the highest
Priority among all cameras that have IsMainCamera set to true.Determines render order when multiple cameras are active. Higher value renders on top. Range 1–16.
Rendering
The background color shown when no sky is present in the scene. Only used when
ClearFlags includes Color.Controls which buffers are cleared before rendering. The default clears color, stencil, and depth.
Only GameObjects whose tags match any tag in this set are rendered. If the set is empty, all objects are rendered.
GameObjects whose tags match any tag in this set are excluded from rendering. Applied after
RenderTags.The portion of the screen this camera renders to, normalized 0–1. The components are
(x, y, width, height).When set, the camera renders to this texture asset instead of the screen. Useful for security cameras, mirrors, and preview windows.
Post-processing
Enables or disables all post-processing effects for this camera. Disable to get a raw, unprocessed render.
If set, post-process volume lookups use this GameObject’s position rather than the camera’s position. Useful when the camera is far from the scene action.
Utility methods
| Method | Description |
|---|---|
PointToScreenNormal(Vector3) | Converts a world-space position to normalized screen coordinates (0–1). |
PointToScreenPixels(Vector3) | Converts a world-space position to screen pixel coordinates. |
ScreenPixelToRay(Vector2) | Returns a ray from the camera through a screen pixel. Useful for mouse picking. |
ScreenNormalToRay(Vector3) | Returns a ray from the camera through a normalized screen position. |
ScreenToWorld(Vector2) | Converts screen coordinates to a world-space point on the near frustum plane. |
GetFrustum() | Returns the view frustum for the current screen rect. |
RenderToTexture(Texture) | Renders the scene from this camera’s view into the supplied render target texture. |
UpdateSceneCamera(SceneCamera) | Manually pushes all component settings to a SceneCamera object. |
Code examples
Setting up a camera from code
Switching the main camera
UseIsMainCamera to hand rendering off between cameras. The engine automatically picks the highest-priority active main camera.