wikis / Unreal Engine / wiki / concepts / cameras-and-ui.md view as markdown report a mistake
Cameras & User Interfaces (UMG/HUD)
Definition
The Camera represents the player's point of view — how the player sees the
world — so cameras only matter for human-controlled players. A PlayerController
specifies a camera class and instantiates a Camera Actor (ACameraActor) whose
settings live on a Camera Component. On the presentation side, User
Interfaces (UIs) and Heads-up Displays (HUDs) are the game's way of conveying
information to the player and, in some cases, taking directed input. Each
human-controlled player has its own HUD (AHUD) instance that draws to its
Viewport, and lower-level drawing is done through the Canvas and the Slate
UI framework.
How It Works
CameraActor and CameraComponent. All of a camera's behavior and properties are
configured on the Camera Component; the CameraActor class primarily acts as a
wrapper so the camera can be placed directly in the level. A CameraComponent
represents a viewpoint and its settings — Projection Type, Field Of View,
and Post-Process Overrides. In the Editor, Details > Camera Settings sets
whether the camera is Perspective or Orthographic: perspective mode uses a
vertical field of view (FOV), while orthographic mode uses a width in world
units. Both modes support an aspect ratio (with device presets) and scalable
Post process effects. A FrustumComponent (shown via Show > Advanced > Camera Frustums) visualizes the FOV in the editor but is hidden during gameplay.
View targets. An Actor becomes the camera source (ViewTarget) if it is a
CameraActor or contains a CameraComponent and has bFindCameraComponentWhenView Target set to true. Any Pawn with bTakeCameraControlWhenPossessed set will
automatically become the ViewTarget when possessed by the PlayerController. Both
PlayerControllers and Actors expose a CalcCamera function: an Actor's CalcCamera
returns the view of its first CameraComponent (when bFindCameraComponentWhenView Target is true), otherwise its location and rotation; the PlayerController's
version returns the possessed Pawn's location with the controller's control
rotation.
PlayerCameraManager. The PlayerCameraManager manages the camera for one
player and defines the final view properties used by systems like the Renderer. It
can compute camera properties directly or blend between Actors (for example,
blending from one CameraActor to another). It answers Get() functions such as
GetCameraViewPoint, maintains a view target, and can apply post effects. If you
subclass it in Blueprint rather than C++, override BlueprintUpdateCamera
(return true to use its values, false to ignore them); UpdateViewTarget
queries the ViewTarget and calls BlueprintUpdateCamera when you are not looking
through a CameraComponent. The ViewTarget struct carries the target Actor, its
Controller, and the PlayerState, and passes its point of view as an
FMinimalViewInfo struct containing Location, Rotation, Projection Mode, FOV,
Orthographic Width, Aspect Ratio, and Post Process Effects. This whole flow is the
camera "responsibility chain", which passes down through ALocalPlayer and
ends with Rendering, Scene View (FSceneView), and related systems.
HUD, Canvas and Slate. The HUD is the base object for elements overlaid on
the screen — score, health, remaining time — and is usually non-interactive. Every
human player has its own AHUD instance drawing to its Viewport (in splitscreen,
each HUD still draws to its own Viewport), and the HUD class is specified by the
gametype in use. During the HUD's render loop, the Canvas object draws text,
texture and material tiles, arbitrary triangles, and simple primitive shapes;
unless you use a specialized alternative, Canvas is the standard way to build HUDs
and UIs. Slate is Unreal's custom, platform-agnostic UI framework — the
declarative foundation for editor tools and in-game interfaces (the widget-based UI
built on top of it, UMG, sits on this framework). Menus and interactive UIs are
usually overlaid on the screen like the HUD, but can also be rendered onto a surface
in the world.
Key Parameters
- Camera classes —
ACameraActor(level-placeable wrapper), CameraComponent (holds the actual settings), PlayerCameraManager, and the ViewTarget struct. - CameraComponent settings — Projection Type (Perspective / Orthographic), Field Of View, Post-Process Overrides; vertical FOV for perspective, world-unit width for orthographic, plus aspect ratio.
- View-target flags —
bFindCameraComponentWhenViewTargetandbTakeCameraControlWhenPossessed. - Camera functions —
CalcCamera,GetCameraViewPoint,BlueprintUpdateCamera,UpdateViewTarget; view data travels as an FMinimalViewInfo struct. - Editor visualization — FrustumComponent via
Show > Advanced > Camera Frustums. - UI classes — HUD (
AHUD), Canvas, Slate; each HUD draws to its own Viewport and its class is set by the gametype.
When To Use
Place a CameraActor in the level when you want a fixed or blended cinematic
viewpoint, and drive per-frame camera logic through the PlayerCameraManager
(via BlueprintUpdateCamera for custom behavior). Use ViewTarget flags to let a
possessed Pawn automatically own the view. For on-screen information, draw
non-interactive status through the HUD/Canvas; for menus and richer
interactive interfaces, build on Slate (and its widget layer).
Risks & Pitfalls
- Cameras only have relevance to human-controlled players — there is no meaningful camera for a purely AI-driven Pawn.
- If a Pawn's camera does not activate on possession, check
bFindCameraComponentWhenViewTargetandbTakeCameraControlWhenPossessed. - The FrustumComponent is editor-only and never visible during gameplay, so do not rely on it as an in-game indicator.
- The HUD/UI boundary is a gray area: HUDs are meant to be non-interactive, so interactive elements generally belong in a Slate-based UI, not the HUD.
Related Concepts
- gameplay framework — PlayerController, Pawn possession, and gametype that select the camera and HUD classes.
- ai behavior trees — the AI debugger can overlay the active HUD class.
- actors and components — CameraComponent and FrustumComponent are Actor components.
- blueprints visual scripting — subclassing PlayerCameraManager in Blueprint via BlueprintUpdateCamera.
Sources
- raw/gameplay/cameras-in-unreal-engine.md
- raw/gameplay/user-interfaces-and-huds-in-unreal-engine.md
