Skip to main content

Cameras & lights

Camera​

The game is shown through the main camera. Every new scene has one called Camera. What you see in the editor’s 3D view is not the game camera — press ▶ Play to see through it.

FieldWhat it does
Main cameraThe game is shown through this camera. Only one camera should be main.
ProjectionPerspective (3D) — far things look smaller. Orthographic (flat) — no perspective, like an isometric or 2D game.
Field of view(Perspective) How wide it sees, 20–120°. 60 is normal; lower zooms in.
View size(Orthographic) Half the height of the view, in meters.
Near / FarNothing closer than Near or farther than Far is drawn.
Viewport RectThe part of the screen it draws into: X, Y, W, H from the bottom-left corner, 0 to 1 (Unity's Viewport Rect). 0, 0, 1, 1 is the whole screen.
DepthCameras on the screen draw from the lowest Depth up: a higher one is drawn over the others.
Clear FlagsSkybox fills its part of the screen with the sky first. Depth only draws over what the cameras before it drew (a weapon or a 3D HUD camera).
card camera
Orthographic camera
Orthographic camera

Split screen and picture-in-picture​

Only the main camera draws the game, unless another camera has Draw on screen on: then it draws into its own Viewport Rect as well. That gives:

  • Split screen for two players: the main camera at X 0, Y 0, W 0.5, H 1 (left half), a second camera at X 0.5, Y 0, W 0.5, H 1 (right half), each following its own player.
  • A map or a rear-view mirror in a corner: a camera with a small rect and a higher Depth than the main camera, so it is drawn on top. An Orthographic camera looking straight down makes a map.

Screen effects are applied to each camera's part on its own. Buttons and text on the screen (UI) cover the whole screen, whatever the rects. Taps and the mouse are read in the main camera's part.

Two players and a map camera on top (Depth 1)
Two players and a map camera on top (Depth 1)

Make the camera follow the player​

Add the Camera follow behavior to the camera and set its Target to your player. See Behaviors. Actions: Shake camera, Camera look at, Set camera position.

For several shots with smooth blends between them (follow, orbit, a dolly along a curve, a 2D camera with a dead zone), use Virtual cameras.

Lights​

Add lights from + Add → Lights. Every scene starts with a Sun. Change a light’s kind in its Light card.

☀️ Sun (directional)
☀️ Sun (directional)
💡 Lamp (point)
💡 Lamp (point)
🔦 Spotlight
🔦 Spotlight
🌤 Sky (hemisphere)
🌤 Sky (hemisphere)
KindLike…Notes
☀️ Sun (directional)SunlightParallel rays from one direction; only its rotation matters. The main light of outdoor scenes.
💡 Lamp (point)A light bulbShines in all directions from its position. Range limits how far (0 = unlimited).
🔦 SpotlightA torchA cone of light. Cone angle sets its width.
🌤 Sky (hemisphere)Sky and ground bounceSoft light: Sky color from above, Ground color from below. No shadows. Great fill light.

Common fields: Color, Brightness (0–5), Mode (Realtime, Mixed or Baked: see Baked lighting), Casts shadows.

Shadow cascades​

A Sun that casts shadows has Shadow cascades (Off, 2, 3 or 4). Off is one shadow map fitted to what the camera sees, out to the quality level's Shadow distance (40 m on High), where shadows fade out. A shorter distance gives sharper shadows. With cascades, the shadow is cut into several maps of growing size, so shadows stay sharp near the camera and still reach far, which suits big outdoor scenes: raise the Shadow distance (up to 200 m) for them. Cascades also reach the Shadow distance; neighbouring cascades blend into each other and the last one fades out, so there is no line where one ends. It works in the game only (the editor view keeps the single map), and only for one Sun per scene. Each cascade is one more shadow draw, so use 2 on phones; Low graphics quality (shadows off) turns cascades off with the rest.

Lighting on phones

Shadows are the most expensive part of drawing. Keep one shadow-casting light (the sun), turn shadows off on lamps, and use Ambient light (Scene tab) or a Sky light to brighten dark areas. You can turn all shadows off in Project settings.

Lens flare​

A Sun, Lamp or Spotlight can have a Lens flare: a bright glow, a long thin streak and a string of soft rings across the screen when you look toward the light, like the sun in a camera lens. Flare size and Flare strength tune it (1 is normal).

  • The flare is on the screen only when the light is in front of you, and it fades out toward the edge of the screen.
  • It goes out when something solid is between the camera and the light (a wall, a hill, a building) and comes back softly when the way is clear. Glass, water and effects don't block it.
  • A Sun's flare sits where the sun would be in the sky, as far as the camera sees. A lamp's flare is at the lamp, and fades when the lamp is far away.
  • It works in the game only: the editor view doesn't draw flares. It costs a few extra pictures on the screen, so it is cheap.