Week 1 — Unity Fundamentals · w1d4 · 2h 20m

W1D4: Prefabs, lights and materials

Week 1 Day 4 of Lucian's Unity course: prefabs, variants, nested prefabs, the four light types, camera tricks with render textures, and material maps.

Lucian Lazar · 12 Jul 2024

Day four is the one where Unity starts feeling like a tool instead of a toy. We spend most of the session on prefabs — what they actually are on disk, how overrides work, what a variant is and why it saved Lucian’s team a pile of time when it shipped — then move through lights, cameras and materials. It’s a fundamentals session with a lot of poking at the editor, not a build-a-game session. If you’ve done the first three days and can place a cube and a rigidbody, you’re ready for this.

What’s covered

Prefabs from the ground up

  • A prefab is a game object turned into a file. Lucian opens the .prefab in a text editor to show it’s just a readable description: transform, mesh filter, mesh renderer, sphere collider, rigidbody, properties. Nothing magic.
  • Once you make a prefab, the scene stops storing the object’s properties and stores an address instead. Same as your house address versus a description of every door in it.
  • Prefab instances: drag the file into a scene, you get an instance. Change the file, every instance follows.
  • Overrides. Modify a property on one instance and it goes bold with a blue line. That property is now locked away from the prefab. Position and rotation are always treated as overridden — you don’t want objects teleporting when someone edits the base prefab.
  • The sneaky trick: nudge a value and set it back, and you’ve “locked” it without changing anything. No lock button needed, it falls out of how overrides work.
  • Applying in the other direction — right click, apply to prefab — pushes an instance’s value back up to the file.
  • Dependencies. A prefab doesn’t store its physics material or its visual material, it references them by GUID. Every asset and every folder gets a .meta file with a unique ID, and that’s how Unity wires everything together. Export a prefab as a Unity package and dependencies come along by default.

Prefab mode and variants

  • Double click to edit a prefab in isolation, including UI prefabs (a canvas with a button, edited in its own context).
  • Variants: a prefab of a prefab. Base ball, blue ball, red ball. Change the base and both variants follow, unless they override.
  • Any depth of inheritance is allowed. Variant of a variant of a variant. Lucian is blunt that this is enormous for UI work — before variants existed you wrote custom scripts to fake it.
  • Nested prefabs: drop a particle system prefab into the blue ball variant, and all blue balls get particles that still track the particle system’s own prefab.
  • Unpack completely, and the difference between creating a new original prefab versus a variant when Unity prompts you.

Lights

  • Directional light as the sun: parallel rays, mathematically infinitely far away, cheapest to compute, added to every new scene.
  • Where the “why is it still lit?” light comes from — ambient lighting from the skybox, and how to kill it in the lighting settings.
  • Shadow types, soft versus hard, and the honest performance note: on mobile that switch can be 40 to 60 FPS.
  • Cookies for shaping light, like a dirty flashlight lens.
  • Culling masks, which leads into layers and tags: what a light illuminates, what a camera sees, and the physics collision matrix deciding what collides with what.
  • Point, spot and area lights, with a quick sketch of how you’d script a flickering torch by randomising intensity every couple hundred milliseconds.
  • Baked versus realtime, marking objects static, and why a single room might take 30 minutes to bake.

Cameras

  • Main camera tag, what it means, and what it doesn’t mean (it doesn’t decide which camera wins the screen).
  • Render textures. Lucian builds a rear-view mirror live: second camera, render texture asset, material with the texture in albedo, plane in the scene. Then parents the camera to the mirror plane and admits he’s never done this before but likes it.
  • Perspective versus orthographic, explained through the camera frustum — a cone versus an elongated box.
  • Near and far clipping planes, and why the far plane is a performance dial.

Materials, shaders and textures

  • A shader is a program for your GPU. A material is an instance of a shader with properties attached.
  • Albedo as the base colour/texture map.
  • Normal maps: generated from the brick texture with a free tool, imported, texture type set to Normal map, applied. The sphere comparison with and without is the clearest moment in this part.
  • Specular maps and the standard specular setup shader, plus smoothness.
  • Reflection probes, set to realtime, so the shiny sphere actually reflects the moving cube.
  • Legacy transparent bumped specular shader for a glass-ish material, and why there are so many shader variants (how many lights they respond to, mobile versus desktop).

Timestamps

  • 00:03:30 — Q&A: how long until you feel like you can build anything in Unity (Lucian’s answer: roughly a year at a couple hours a day, 40 hours for one specific skill)
  • 00:08:00 — Course roadmap, and the warning about Week 2 Day 3 being a three-hour programming marathon
  • 00:12:00 — What a prefab is, what a .unity scene file actually stores
  • 00:16:30 — Making a prefab by dragging into the project window, then opening it as a text file
  • 00:21:00 — Instances, and editing the prefab to change every copy at once
  • 00:24:30 — Overrides, the blue line, and why position and rotation are always overridden
  • 00:31:00 — Dependencies, .meta files, GUIDs, and exporting a Unity package
  • 00:38:00 — Prefab mode: editing in isolation, including a UI canvas with a button
  • 00:45:00 — Apply to prefab, revert, reset, and locking values by faking an override
  • 00:52:00 — Prefab variants: ball base, ball blue, ball red, and variant-of-variant inheritance
  • 01:03:00 — Nested prefabs: a particle system prefab inside the blue ball variant
  • 01:15:00 — Directional light, skybox ambient lighting, faking a day/night cycle
  • 01:23:00 — Shadow types, cookies, baked versus realtime, marking objects static
  • 01:29:00 — Culling masks leading into layers, tags, and the physics collision matrix
  • 01:37:00 — Point, spot and area lights, and scripting a flickering torch
  • 01:46:00 — Cameras, render textures, and building a rear-view mirror then a real mirror
  • 01:57:00 — Perspective versus orthographic, the frustum, clipping planes
  • 02:03:00 — Materials and shaders, albedo, importing a brick texture
  • 02:11:00 — Normal maps: generating one, importing it, seeing it on a sphere
  • 02:18:00 — Specular maps, smoothness, reflection probes, and a transparent legacy shader

What you take away

You leave with a working mental model of the prefab system — not just “drag it in the folder,” but what the file contains, what the scene keeps, how overrides interact with edits to the base, and when a variant beats a copy. That’s the thing most tutorials skip and most beginners get burned by later.

On the lighting side, you’ll know which of the four light types to reach for, what ambient light is doing when your “dark” scene isn’t dark, and where the performance knobs are. The camera section gives you render textures, which is the same technique behind mirrors, minimaps and portal effects.

Materials get a first pass rather than a deep treatment. Lucian says plainly that shaders are a big subject and this course leans programmatic, so you get albedo, normal, specular, transparency and reflection probes — enough to make things look less flat and to understand what you’re looking at when you open someone else’s material.

Who should watch this

Anyone who’s finished the first three days and wants the editor concepts nailed down before the programming week starts. It’s also useful on its own if you’ve been using Unity casually and never understood why prefab overrides behave the way they do, or what a .meta file is for. Skip it if you already ship projects with nested prefab variants and bake your lighting — there’s nothing here you don’t know.

Part of the full curriculum. Course overview.