Unity Mastery Handbook
Topic chapterT02P1 · Foundations: Editor, C#, Maths, Physics, 2D/3D

The Unity Editor: Scenes, GameObjects, Components & Prefabs

Find your way around the Unity Editor, then build scenes out of GameObjects and components, place them precisely with the Transform and snapping tools, and turn what you build into prefabs, variants and nested prefabs you can reuse.

Study time
6–8 hours
Reading time
76 min read · 13,489 words
Prerequisites
T01 · Setting Up: Unity 6, Hub, IDE, Packages & Version Control
Courses merged
2 course files
Your progress
—
After this chapter you can…
  • Name every window in the default layout and what it's for, and rearrange, save and reset layouts
  • Move around the Scene view quickly with the View tool, flythrough mode, framing and the Orientation overlay
  • Explain the GameObject and component model, and add, configure, copy and remove components in the Inspector
  • Position, rotate and scale objects precisely using local and world space, parenting, pivots and snapping
  • Create, save and organise scenes and assets, and choose which scenes go into a build
  • Make prefabs, edit them in Prefab Mode, and use overrides, nested prefabs and variants without losing work
  • Use Play mode to test changes, knowing which changes are thrown away and which are kept
  • Build a small diorama from primitives and prefabs, with two scripts that bring it to life

The Unity Editor is where you assemble a game: you place objects, give them behaviour, and test the result without leaving the program. It looks crowded the first time you open it, but it's built on one simple idea, and once you see that idea every window makes sense. This chapter teaches that idea, then each window and tool in turn, and ends with a small island diorama that uses all of them.

You don't need to know any C# yet. The guided build has two short scripts, and you'll copy them in and use them as ready-made components. T03 · C# Fundamentals: Types, Logic, Methods & Classes and T05 · Scripting in Unity: Lifecycle, Serialization, Coroutines & Awaitable explain every line of them later.

The big picture#

Everything in a Unity game is built from three things:

  • Scenes. A scene is one space in your game: a level, a menu, a test room. It's saved as a file (Level1.unity) and it contains a list of GameObjects.
  • GameObjects. A GameObject is anything in a scene: a player, a wall, a light, a camera, an invisible trigger. On its own, a GameObject does nothing. It's an empty container with a name and a position.
  • Components. Components are what make a GameObject something. A Mesh Renderer makes it visible, a Collider makes it solid, a Light makes it shine, a Camera lets it see, and a script you write makes it behave your way. A GameObject is whatever its components make it.

Around those three are assets: the files in your project's Assets/ folder that scenes use, such as meshes, textures, materials, sounds, scripts and prefabs. A prefab is a GameObject saved as an asset, so you can place copies of it in many scenes and change them all at once.

Project · Assets/ Island.unity Cottage.prefab Stone.mat Spin.cs + meshes, textures, sounds… Scene · Hierarchy Main Camera Directional Light Lighthouse Lamp (child) Cottage Cottage (1) Inspector · Lighthouse Transform Mesh Filter Mesh Renderer Spin (your script) Add Component opens copies select
Assets live in the project. A scene is a list of GameObjects, some of them copies (instances) of a prefab. Selecting a GameObject shows its components in the Inspector. The Lamp is a child of the Lighthouse, so it moves with it.

This is called composition: instead of a "Lighthouse" type with lighthouse powers, you take a plain GameObject and attach the pieces you need. Want the lighthouse to spin? Add a Spin component. Want it to make a sound? Add an Audio Source. The same pieces combine into anything, and a script you write is just one more piece.

A tour of the Editor#

Open your project from T01, or create a new Universal 3D project. Its sample scene opens with three GameObjects: a Main Camera, a Directional Light (the sun), and a Global Volume that holds post-processing settings. The default layout looks like this:

Toolbar account · services · Play / Pause / Step · search · layout Hierarchy every GameObject in the open scene(s) Scene view | Game view Scene: edit the world with tools Game: what the camera sees when you play overlays: Tools, Tool Settings, Grid and Snap… Inspector components and settings of the selected item Project | Console Project: the Assets/ and Packages/ folders Console: messages, warnings and errors
The default layout. Every panel is a window you can move, dock, stack as a tab, or close. If you lose one, it's under Window > General.

The six windows you'll use every day#

WindowWhat it showsYou use it to
HierarchyEvery GameObject in the open scene, as a tree of parents and childrenCreate, select, rename, reorder and group GameObjects
Scene viewThe world, seen through a free editing cameraLook around, select objects, move, rotate and scale them
Game viewWhat the scene's camera sees, as the player willPlay and test the game
InspectorThe components and settings of whatever is selectedChange values, add and remove components, edit import settings
ProjectThe files in Assets/ and Packages/Find, create, organise and import assets
ConsoleLog messages, warnings and errors (Ctrl+Shift+C)Read what your code and Unity report, and jump to the line that caused it

Selection is shared. Click a GameObject in the Hierarchy and it's selected in the Scene view too, and the Inspector shows it. Click an asset in the Project window and the Inspector shows that asset instead. When something seems to be missing from the Inspector, check what's selected.

The toolbar#

Across the top is the main toolbar. The controls you'll use most are the Play, Pause and Step buttons in the middle, the search button (Unity Search, also on Ctrl+K), Undo History, and the Layout dropdown. The rest give you your account, the Asset Store, the Package Manager, cloud services and Unity's AI tools.

Arranging windows and layouts#

  • Move a window by dragging its tab. Drop it on the edge of another window to dock it beside, or on the tab bar to stack it as another tab.
  • Maximise the window under the mouse with Shift+Space, and press it again to restore. It's the quickest way to get a big Scene view for a minute.
  • Open more windows from Window > General, or from any window's ⋮ menu > Add Tab. You can have two Inspectors, two Scene views or two Project windows.
  • Save a layout from the Layout dropdown > Save Layout. Studios often keep one layout for building levels, one for animation and one for coding.
  • Reset when everything is a mess: Window > Layouts > Default (or the Layout dropdown).

Moving around the Scene view#

The Scene view is a window onto your world through an editing camera that only you see, called the Scene Camera. Moving around quickly is the single most useful Editor skill, so practise the controls until you stop thinking about them.

ToDo this (3-button mouse)Notes
Fly like a game cameraHold the right mouse button, then move the mouse to look and use W A S D to move, Q E down and upHold Shift to go faster. Scroll while flying to change the speed
Orbit around a pointAlt + left-drag (macOS: Option)Orbits the current pivot, usually the last thing you framed
PanMiddle-dragOr select the View tool (Q) and left-drag
ZoomScroll wheel, or Alt + right-dragZooming moves toward the pivot, so frame something first
Frame the selectionF with the mouse over the Scene viewAlso Edit > Frame Selected. Double-clicking an object in the Hierarchy does the same
Follow a moving objectShift+FEdit > Lock View to Selected. Useful in Play mode
WalkArrow keysUp and Down move forward and back; Left and Right pan sideways

On a laptop without a middle button, pan with Alt+Ctrl + left-drag (macOS: Option+Cmd). On a Mac trackpad, drag with two fingers to zoom.

Overlays#

The small floating toolbars inside the Scene view are called overlays. By default you get:

  • Tools: the transform tools (Move, Rotate, Scale…), covered below.
  • Tool Settings: options for the current tool, including the Pivot / Center and Local / Global handle settings.
  • Grid and Snap: the grid and snapping controls.
  • Draw Modes: how meshes are drawn (shaded, wireframe, and debug views).
  • View Options: the 2D toggle, lighting, audio, effects such as the skybox, scene visibility, which layers to show, the Scene Camera settings (including its speed), and gizmos.
  • Orientation: the axis widget in the top right corner.

Press ` (the key above Tab) with the mouse over the Scene view to open the Overlays menu, where you can show and hide each one. Drag an overlay by its handle to move it, or dock it against an edge.

The Orientation overlay (older tutorials call it the Scene Gizmo) is worth learning. Click one of its coloured arms to look straight along that axis: the green Y arm gives you a top-down view. Click the cube in the middle, or the label under it, to switch between perspective (things further away look smaller, as in real life) and orthographic (no perspective, like an architect's drawing). Orthographic side and top views are the easiest way to line things up exactly.

The Scene Camera isn't your game camera#

Moving around the Scene view never changes what the player sees. The player sees through a GameObject with a Camera component, usually the Main Camera, and the Game view shows that. To make the game camera match your current view, select the camera and choose GameObject > Align With View (Ctrl+Shift+F). It's the easiest way to frame a shot: fly to a nice angle in the Scene view, then align the camera to it. The Cameras overlay can also let you look through and steer a scene camera directly from the Scene view.

GameObjects#

Create GameObjects from the GameObject menu, or by right-clicking in the Hierarchy. The most useful entries:

  • Create Empty (Ctrl+Shift+N): a GameObject with only a Transform. Empties are used as folders, pivots and spawn points.
  • 3D Object: ready-made shapes (called primitives) with a mesh, a renderer and a collider already attached.
  • Light, Audio, UI, Camera, Effects: GameObjects pre-built with the right component.

Primitives have exact sizes, which makes them handy as measuring sticks while you build:

PrimitiveSize at scale 1Good for
Cube1 × 1 × 1Walls, crates, steps, blocking out a level
Sphere1 across (radius 0.5)Balls, planets, projectiles, tree tops
Capsule1 across, 2 tallA stand-in for a character (a person is about 1.8 m tall)
Cylinder1 across, 2 tallPosts, pillars, towers, wheels. Its collider is a capsule, not a cylinder
Plane10 × 10, flat on the XZ planeFloors. Only visible from above
Quad1 × 1, flat on the XY planeSigns, screens, simple billboards. Visible from one side only

The GameObject header#

Select a GameObject and the top of the Inspector shows settings that belong to the GameObject itself rather than to any component:

  • Active checkbox, left of the name. An inactive GameObject is switched off completely: not drawn, not colliding, its scripts don't run. Inactive objects look faded in the Hierarchy.
  • Name. Names don't have to be unique, but clear names save you time. Rename with F2 (macOS: Enter).
  • Tag. One word that marks what the object is, such as Player or Collectable, so scripts can recognise it. A GameObject has exactly one tag.
  • Layer. A number from 0 to 31 that systems use to include or ignore groups of objects: which layers a camera draws, which layers collide, which layers a raycast hits. Layers come back in T08 · 3D Physics: Rigidbodies, Colliders, Raycasts & Character Controllers.
  • Static. A promise that the object never moves while the game runs, so Unity can precompute things like baked lighting and batching for it.

Active, and active in the hierarchy#

Deactivating a parent deactivates all its children, even though each child's own checkbox stays ticked. Unity tracks the two separately: active self is the object's own checkbox, and active in hierarchy is whether it's really running, which is only true when it and every parent are active. When you reactivate the parent, the children go back to the state their own checkboxes say. You'll meet the same two ideas in code as activeSelf and activeInHierarchy.

Tags and layers#

Unity comes with a few tags (Untagged, Respawn, Finish, EditorOnly, MainCamera, Player, GameController). Two of them do something special:

  • MainCamera is how Unity finds "the" camera when code asks for Camera.main.
  • EditorOnly objects, and their children, are removed when you build the game. Use it for notes, helpers and test objects that should never ship.

Add your own with Tag > Add Tag…, which opens the Tags and Layers settings. A tag can't be renamed once it's created, so choose names you'll keep. Layers are added in the same place. Some low layers are built in (Default, TransparentFX, Ignore Raycast, Water, UI), and the rest are yours.

Static flags#

The Static checkbox is really a set of flags, one per system that can precompute data for objects that don't move: baked global illumination (Contribute GI), occlusion culling (Occluder and Occludee Static), static batching (Batching Static) and baked reflection probes. Ticking the box turns them all on; the dropdown beside it lets you pick. Only tick what a system needs. Marking every object static wastes bake time and memory, and an object marked static that you then move at runtime won't behave correctly in those systems.

The Transform#

Every GameObject has exactly one Transform, and you can't remove it. It stores three things:

  • Position: where the object is, as X, Y and Z.
  • Rotation: which way it faces, shown as angles in degrees around X, Y and Z.
  • Scale: how big it is along each axis, where 1 is its original size.

It also stores the object's parent. That's why dragging one object onto another in the Hierarchy is a Transform operation: you're changing whose space the object lives in.

Units and axes#

One Unity unit is one metre, by convention. Nothing forces it, but physics assumes it (gravity is 9.81 units per second per second), and assets from the Asset Store and other tools are made that way. Build at real scale: a door about 2 units tall, a person about 1.8. A level built ten times too big makes everything fall in slow motion.

Unity is Y-up and left-handed: X points right, Y points up, and Z points forward, into the screen. The axes are always coloured the same way, everywhere in the Editor: X is red, Y is green, Z is blue (think RGB = XYZ). "Forward" for a character or camera means its blue Z axis, which matters later when you move things with code.

Local and world space#

The values in the Inspector are measured relative to the parent. If an object has no parent, its parent is the world, and its values are world values. If it has a parent, the Inspector shows its local position, rotation and scale: how far it is from its parent, in the parent's own directions.

X Y world origin (0, 0, 0) Boat Mast local (0, 3, 0) world (5, 3, 0) Boat: (5, 0, 0), no parent Boat, rotated 30° Mast tilts with its parent, but its local values don't change: local (0, 3, 0)
A child stores where it is relative to its parent. Move, rotate or scale the parent and the child follows, while the numbers in its Inspector stay the same.

This is what makes hierarchies so useful. Build a ship once, with a mast, sails and a flag as children, and you can move, turn and copy the whole ship by moving the parent. The children keep their places on the ship.

Parenting#

  • Make a child: drag one GameObject onto another in the Hierarchy. The child keeps its world position: Unity recalculates its local values so it doesn't jump.
  • Unparent: drag it out to the empty area at the bottom, or between two root objects.
  • Group under a new parent: select one or more objects, right-click, and choose Create Empty Parent (Ctrl+Shift+G).
  • New empty child: Alt+Shift+N creates one under the selection.
  • Paste as Child (Ctrl+Shift+V) pastes a copied object under the selected one, keeping its world position.
  • Set as Default Parent (right-click menu): new objects and objects you drag into the scene go under it. Its name shows in bold. Handy when you're placing fifty rocks.

Pivots: where an object turns#

An object rotates and scales around its pivot, which is the point its position refers to. For primitives the pivot is the centre. For imported models it's wherever the artist put it, often at the feet. When the pivot is in the wrong place (a door that spins around its middle instead of its hinge), the fix is an empty parent: put an empty at the hinge, make the door its child, and rotate the empty. You'll do exactly this in the guided build.

Rotation and scale, with care#

The Inspector shows rotation as three angles (called Euler angles), because people understand them. Internally, Unity stores rotation as a quaternion, which avoids some problems angles have. That's why typing 370 into a rotation field can come back as 10, and why the three numbers sometimes change in surprising ways when you rotate with the tool. It's the same rotation, described differently. T06 · Game Maths: Vectors, Trigonometry, Matrices, Quaternions & Interpolation explains quaternions properly.

Scale has three rules worth keeping:

  1. Keep scale uniform where you can (the same number on all three axes). A parent with non-uniform scale, such as (1, 4, 1), stretches and skews any rotated child, and sphere and capsule colliders can't stretch into ovals.
  2. Never set a scale axis to 0. It makes some maths impossible, and Unity can produce rendering glitches or errors.
  3. Fix a model's size when you import it rather than by scaling the object, using the model's Scale Factor import setting. Then every copy is the right size from the start.

Click the link icon next to Scale (Constrained Proportions) to make the three values change together.

Placing things precisely#

The transform tools#

KeyToolWhat the handle does
QViewLeft-drag pans the view; nothing gets moved by accident
WMoveDrag an arrow to move along one axis, a coloured square to move in a plane, the centre to move freely
ERotateDrag a coloured ring to rotate around that axis; the outer ring rotates around the view direction
RScaleDrag an axis to stretch along it, the centre cube to scale evenly
TRectMove, resize and rotate as a flat rectangle. Made for 2D and UI, but works on 3D objects too
YTransformMove, rotate and (with Local handles) scale in one combined handle

The axis you drag turns yellow. Hold Shift while dragging the Move tool's centre to slide the object along a plane facing the camera.

The Tool Settings overlay has two toggles that change where and how the handle sits:

  • Pivot / Center (Z): put the handle at the object's pivot, or at the centre of everything selected.
  • Local / Global (X): line the handle up with the object's own axes, or with the world's. To push a tilted plank along its own length, use Local. To move it straight up, use Global.

Typing numbers, and maths in fields#

For exact placement, type into the Transform fields. You can also drag left and right on a field's label (the "X") to scrub the value. Numeric fields accept maths: type 2.5*4 and you get 10. With several objects selected they accept special functions too:

  • L(0,20) spreads the values evenly from 0 to 20, so ten selected fence posts end up evenly spaced.
  • R(-5,5) gives each object a random value between −5 and 5, for natural-looking rocks and trees.
  • +=2, -=2, *=2, /=2 change every selected value at once.

Combine them to lay objects out in a circle: with several objects selected, set X to cos(L(0,2*pi))*6 and Z to sin(L(0,2*pi))*6. They're spread around a circle of radius 6. (The first and last object land on the same spot, because 0 and 2π are the same angle; use one more object than you need and delete it, or stop just short of 2*pi.)

Snapping#

  • Increment snapping: hold Ctrl (macOS: Cmd) while you move, rotate or scale, and the value changes in fixed steps. Set the step sizes from the arrow next to the grid snap button in the Grid and Snap overlay.
  • Grid snapping: turn on the grid snap button in the Grid and Snap overlay and moved objects land on grid points. It works with Global handles only. Push to Grid (Ctrl+\) snaps the selection onto the nearest grid points.
  • Vertex snapping: with the Move tool, hold V, hover over a corner of the selected mesh, then drag: that corner snaps to corners of other meshes. It's the way to butt two road pieces or walls together exactly.
  • Surface snapping: hold Shift+Ctrl (macOS: Shift+Cmd) and drag the Move handle's centre: the object slides over the surfaces of other objects that have colliders. With the Rotate tool, the same keys turn the object to face a point you hover over.

When you drag a prefab or model from the Project window into the Scene view, it lands where the mouse ray hits something, which is often all the snapping you need.

Other placement commands#

  • Duplicate: Ctrl+D copies the selection in place. Then move the copy.
  • Move To View (Ctrl+Alt+F): moves the selection to the centre of the Scene view.
  • Align With View (Ctrl+Shift+F): moves and turns the selection to match the Scene Camera. Used for cameras and lights.
  • Reset the Transform from its ⋮ menu to put it back at the parent's origin, unrotated, at scale 1.

Components and the Inspector#

Select a GameObject and the Inspector lists its components from top to bottom, Transform first. Each component has a header (its icon, an enable checkbox if it has one, its name, a ? help button and a ⋮ menu) and its properties below.

Adding components#

Click Add Component at the bottom of the Inspector and start typing: "rigid" finds Rigidbody, "audio" finds Audio Source. The same list is in the Component menu, sorted by category. You can also drag a script from the Project window onto a GameObject in the Hierarchy or onto the Inspector.

A GameObject can have any number of components, but some only make sense together. A Rigidbody (physics) needs a Collider to hit anything; a Mesh Renderer needs a Mesh Filter to know which mesh to draw. Some components require another and add it for you, and Unity warns you if you try to remove a component that another one depends on.

Components you'll see everywhere#

ComponentWhat it doesChapter
TransformPosition, rotation, scale and parent. Always therethis one, T06 · Game Maths: Vectors, Trigonometry, Matrices, Quaternions & Interpolation
Mesh FilterHolds which mesh (the 3D shape) to useT33 · Rendering in Unity 6: URP & HDRP, Cameras, PBR Materials & Post-Processing
Mesh RendererDraws that mesh with one or more materials, and casts and receives shadowsT33 · Rendering in Unity 6: URP & HDRP, Cameras, PBR Materials & Post-Processing
Box / Sphere / Capsule / Mesh ColliderGives the object a shape for collisions and clicksT08 · 3D Physics: Rigidbodies, Colliders, Raycasts & Character Controllers
RigidbodyLets physics move the object: gravity, forces, bouncingT08 · 3D Physics: Rigidbodies, Colliders, Raycasts & Character Controllers
CameraRenders the scene from this object's point of viewT07 · Input System, Movement & Cameras (Cinemachine)
LightLights the scene: Directional, Point, Spot or AreaT57 · Lighting & Global Illumination: Baked, Mixed & Realtime, Adaptive Probe Volumes, Reflection Probes & Lighting Art
Audio SourcePlays sound from this object's positionT21 · Audio: Mixers, Sound Design, Adaptive Music, FMOD & Wwise
Your scriptsAnything you write in C#T05 · Scripting in Unity: Lifecycle, Serialization, Coroutines & Awaitable

Editing values#

A component's properties are either values (numbers, text, colours, checkboxes, dropdowns) or references to something else (a mesh, a material, another GameObject, a sound). To set a reference, drag the asset or GameObject onto the field, or click the small circle (⊙) at its right to pick from a list. A reference field that says None is empty. One that says Missing points to something that has been deleted.

The ⋮ menu (or right-click on the header) has the commands you need to manage components:

  • Reset: put the component back to its default values.
  • Remove Component.
  • Move Up / Move Down: reorder. You can also drag headers. Order matters to the reader more than to Unity, so keep the important components near the top.
  • Copy Component, then Paste Component Values onto a component of the same type, or Paste Component As New onto another GameObject.
  • Properties…: opens a small Inspector window locked to just that component.

The enable checkbox switches one component off without removing it, so you can test the scene without a light, without a script, or without a collider. Only components that do something every frame or can be switched on and off have it.

Editing several objects at once#

Select several GameObjects (Ctrl-click or Shift-click in the Hierarchy) and the Inspector shows the components they have in common. A field where their values differ shows a dash (—). Typing a value sets it on all of them, which is where the L() and R() functions above come in.

Inspector tools#

  • Lock (the padlock in the Inspector's top right): the Inspector stops following your selection. Lock it on a light, then click around the scene while you tweak it. Forgetting it's locked is a classic "the Inspector is broken" moment.
  • Properties (Alt+P, or right-click > Properties): opens a floating Inspector for just the selected object. You can have several.
  • Debug mode (Inspector ⋮ menu > Debug): shows the raw data, including private values that the normal view hides. Useful when a script misbehaves. Switch back with Exit Debug.
  • Presets (the slider icon in a component header): save a component's settings as an asset and apply them elsewhere, or make a preset the default for new components of that type. Good for things like "the way we set up a point light".

Materials, lights and the camera, briefly#

Three things make a scene look like anything at all. They each get a full chapter later, but you need the basics to build anything now.

Materials#

A material is an asset that says how a surface looks: its colour, how shiny or metallic it is, which textures it uses. The Mesh Renderer refers to it. Create one with Assets > Create > Material, or from the Project window's + menu. In a URP project it uses the Universal Render Pipeline/Lit shader. Set Base Map's colour swatch to pick a colour, and use Metallic and Smoothness to make it look like metal, plastic or stone. Then drag the material onto an object in the Scene view or the Hierarchy.

A material is shared: every object that uses Stone.mat changes when you edit it. That's what you want for a whole wall of stone, and a surprise when you meant to make one rock darker. Duplicate the material (Ctrl+D in the Project window) for a variation.

Lights#

  • Directional: light from infinitely far away, in one direction, like the sun. Only its rotation matters.
  • Point: light shining in all directions from a point, fading with distance, like a bulb.
  • Spot: a cone of light, like a torch or a lighthouse beam.
  • Area: light from a rectangle or disc. Only used for baked lighting.

Lighting settings for the whole scene (the skybox, ambient light, baking) are in Window > Rendering > Lighting, and they're saved per scene. Post-processing effects such as bloom and colour grading come from a Volume, which is what the template's Global Volume is. T57 · Lighting & Global Illumination: Baked, Mixed & Realtime, Adaptive Probe Volumes, Reflection Probes & Lighting Art covers lighting and baking, and T33 · Rendering in Unity 6: URP & HDRP, Cameras, PBR Materials & Post-Processing covers Volumes and post-processing.

The camera#

The Camera component's most important settings are its Field of View (how wide it sees, in degrees; 60 is the default), its Clipping Planes (nothing nearer than Near or further than Far is drawn), and its Projection (Perspective or Orthographic, the same idea as in the Scene view). Click the camera in the Hierarchy and a small preview of what it sees appears in the corner of the Scene view.

Assets and the Project window#

The Project window shows your Assets/ folder and the read-only packages in Packages/. Its ⋮ menu switches between a one-column tree and the more common two-column layout with folders on the left and contents on the right. The slider at the bottom changes the icon size; drag it all the way left for a list.

Getting assets in#

Drag files from Explorer or Finder into the Project window, or copy them into the Assets folder on disk. Unity notices, imports them into its own formats (the results go in Library/), and creates a .meta file for each. Select an imported asset to see its import settings in the Inspector, such as a texture's maximum size or a model's scale, and click Apply after changing them.

Organising a project#

Unity doesn't care how you arrange folders, but people do. A layout that scales from a jam game to a large project:

A tidy Assets folderText
Assets/
├── _Project/          ← everything you made, in one place
│   ├── Art/
│   │   ├── Materials/
│   │   ├── Models/
│   │   └── Textures/
│   ├── Audio/
│   ├── Prefabs/
│   ├── Scenes/
│   └── Scripts/
├── Settings/          ← render pipeline assets from the template
└── ThirdParty/        ← Asset Store packs, kept separate

The underscore sorts _Project to the top. Keeping your own files apart from imported packs means you can update or delete a pack without hunting through your folders. Some teams prefer folders by feature (Player/, Enemies/, Shop/, each with its own art, prefabs and scripts) instead of by type. Both work; mixing them doesn't.

Finding things#

  • The Project window's search box searches names. Add t: to filter by type and l: by label: t:Material stone, t:Prefab, t:Scene.
  • Labels are tags for assets: select an asset, then use the label button at the bottom of the Inspector's preview. l:Placeholder then finds every placeholder you meant to replace.
  • Favorites, at the top of the folder tree, hold folders and saved searches you use often.
  • Unity Search (Ctrl+K) searches assets, scene objects, menu items and settings from one box. Typing "lighting" finds the Lighting window; "t:Light" finds every light in the scene.
  • The Hierarchy has its own search box, which filters the scene the same way.
  • Right-click an asset > Show in Explorer (Reveal in Finder on macOS) to see it on disk.

Scenes#

A scene is an asset like any other, saved as a .unity file. Small games often have a menu scene and one scene per level. Larger ones load several scenes at once (more on that below).

Creating, opening and saving#

  • New scene: File > New Scene (Ctrl+N) opens the New Scene dialog, where you pick a scene template: Basic gives you a camera and a light, Empty gives you nothing. Right-click in the Project window > Create > Scene makes one from the Basic template without the dialog.
  • Open: double-click the scene asset. If the current scene has unsaved changes, Unity asks first.
  • Save: Ctrl+S. An asterisk after the scene's name in the Hierarchy means unsaved changes.

Which scenes are in the game#

A build only contains the scenes in the scene list. Open File > Build Profiles and look at the Scene List: drag scenes in from the Project window, untick ones you want to keep out, and drag to reorder. The first scene in the list is the one that loads when the game starts. Scenes not in the list can't be loaded by name from code, which is a common cause of "Scene couldn't be loaded" errors.

Several scenes at once#

Drag a second scene from the Project window into the Hierarchy (or right-click it > Open Scene Additive) and both are open together, each with its own header in the Hierarchy. Uses:

One scene is the active scene (its name is bold): objects you create go into it, and its lighting settings are the ones used. Change it from the scene header's ⋮ menu > Set Active Scene. The same menu lets you Unload a scene (keep it listed but closed) or Remove it.

Scene templates#

If every level should start with the same camera rig, lighting and managers, save a scene as a template (right-click the scene > Create > Scene Template From Scene, or from the File menu). It then appears in the New Scene dialog. A template can clone some of its assets (each new scene gets its own copy of, say, its lighting settings) and reference others (all scenes share the same materials).

Prefabs#

A prefab is a GameObject, with all its components and children, saved as an asset. Placing it in a scene makes an instance: a copy that stays linked to the asset. Change the prefab asset and every instance in every scene updates.

Use prefabs for anything that appears more than once (trees, enemies, pickups, doors, a lamp post) and for anything code creates while the game runs (bullets, effects, enemies from a spawner). Even a one-off object is often worth making a prefab, because a prefab is its own file: two people can edit two prefabs at the same time without touching the same scene file, which matters a lot under Git (T01).

Chimney.prefab a prefab of its own Cottage.prefab walls, roof, door + Chimney (nested) Cottage_Fisher.prefab variant: inherits Cottage, blue roof, adds Nets nested in base of Scene Cottage Cottage (1) override: door colour Cottage_Fisher Cottage_Fisher (1) instances instances
Three ideas in one family. Nesting: a prefab can contain instances of other prefabs. Variants: a prefab can be based on another and change parts of it. Overrides: one instance can differ from its prefab, shown by a blue bar in the Inspector.

Making and placing prefabs#

  1. Build the object in the scene: a parent with its children and components.
  2. Drag it from the Hierarchy into a folder in the Project window. It becomes a prefab asset, and the object in the scene becomes its first instance. Its icon in the Hierarchy turns blue.
  3. Drag the prefab from the Project window into the scene (or the Hierarchy) to place more instances.

Instances of the same prefab can sit at different positions and rotations; that's expected, so the root's position and rotation never count as changes to the prefab.

Editing a prefab: Prefab Mode#

To change the prefab itself, open it in Prefab Mode. A breadcrumb bar at the top of the Scene view shows you're inside a prefab, and the Hierarchy shows only its contents. There are two ways in:

  • In isolation: double-click the prefab asset in the Project window. The rest of the scene disappears, so you see the prefab on its own.
  • In context: select an instance in the scene and press P, click Open in its Inspector, or click the small arrow next to it in the Hierarchy. The scene stays visible around it (greyed out by default; the Context option in the bar switches between Normal, Gray and Hidden) so you can fit the prefab to its surroundings. You can't change the root's Transform values in this mode.

Changes are saved automatically while Auto Save (top right of the Scene view) is ticked. Leave Prefab Mode with the back arrow in the Hierarchy or the breadcrumbs.

Overrides: changing one instance#

You can also change an instance directly in the scene: give one cottage a red door, move one tree's branch, add a light to one lamp post. Each change is an override, and the instance keeps every other link to its prefab. Overrides show up as:

  • a blue bar to the left of the changed property or component in the Inspector, and the property name in bold;
  • a plus badge on added components and child objects, and a minus badge on removed ones;
  • a blue bar beside the instance in the Hierarchy when anything inside it is overridden.

The Overrides dropdown at the top of the instance's Inspector lists every override. From it you can:

  • Apply All: push the instance's changes into the prefab asset, so every instance gets them.
  • Revert All: throw the changes away and match the prefab again.
  • Click single overrides to apply or revert just those. You can also right-click any overridden property > Apply or Revert.

An overridden value always wins. If you later change that property on the prefab asset, the instances that override it don't change. That's the rule behind most "I changed the prefab and some of them didn't update" puzzles: check the instance for a blue bar.

Nested prefabs#

A prefab can contain instances of other prefabs. The cottage prefab contains a chimney prefab; the chimney prefab is still its own asset, so improving it improves every chimney on every cottage (and on anything else that uses it). Build bigger prefabs out of smaller ones the same way a building is made of doors and windows. Add a nested prefab by dragging one into a prefab in Prefab Mode, or onto an instance in the scene and then applying the added object.

Prefab variants#

A variant is a prefab based on another prefab. It inherits everything from its base and stores only what it changes. Right-click a prefab > Create > Prefab Variant, or drag an instance with overrides into the Project window and choose Prefab Variant in the dialog that appears. Variant icons are blue cubes with one grey side.

Variants are the clean way to make families: an Enemy base, with Enemy_Fast and Enemy_Armoured variants. Fix a bug in the base and every variant gets the fix, while each variant keeps its own speed or armour. A variant can be based on another variant, but keep chains short (two levels is plenty) or it becomes hard to tell where a value comes from.

Unpacking, replacing and missing prefabs#

  • Unpack (right-click an instance > Prefab > Unpack) turns the instance back into ordinary GameObjects with no link to the asset. Nested prefabs inside it stay as instances; Unpack Completely breaks those links too. Do this when one copy should go its own way for good.
  • Replace (right-click > Prefab > Replace, or drag a prefab onto the instance's Prefab field in the Inspector) swaps an instance to a different prefab and can keep its overrides. Unity matches parts by name, so give children unique names.
  • An instance whose prefab asset has been deleted shows in red in the Hierarchy as a missing prefab. Restore the asset from version control, or unpack the instance to keep what's there.

Play mode#

Press Play (Ctrl+P) and the game runs inside the Editor, in the Game view. Pause (Ctrl+Shift+P) freezes it so you can look around in the Scene view and inspect values; Step (Ctrl+Alt+P) advances one frame at a time. Press Play again to stop.

While playing, the Scene view and Inspector still work. You can move things, change values and watch the effect immediately, which is how most tuning is done.

What you keep and what you lose#

When you stop, the scene goes back to how it was when you pressed Play. That protects you from saving a scene in the middle of a test, but it also throws away every tweak you made while playing. The rule is about where the change lives:

Thrown away when you stopKept
Changes to GameObjects and components in the scene: positions, values on components, objects added or deleted Changes to assets: editing a material, a prefab asset in Prefab Mode, a ScriptableObject, import settings
Anything your scripts did to the scene Changes made outside the scene: Project Settings, Preferences, layouts, files on disk

That second column surprises people. Change the colour of a material while playing and it stays changed, because the material is a file. It's useful (you can tune a material live) and dangerous (a script that changes a shared material's colour at runtime changes the asset too). T33 · Rendering in Unity 6: URP & HDRP, Cameras, PBR Materials & Post-Processing covers how code avoids that.

The Game view#

The Game view's bar at the top controls how the game is shown while you test:

  • Aspect: Free Aspect follows the window size. Pick a fixed ratio such as 16:9, or a resolution, to see what players will see, and add your own with the + at the bottom of the list.
  • Scale: zoom into the image to check details.
  • Play Focused / Play Maximized / Play Unfocused: whether pressing Play focuses or maximises this Game view.
  • Mute Audio, Stats (frame rate and rendering numbers), and Gizmos (show the Scene view's helper drawings in the Game view too).
  • The Game / Simulator switch: the Simulator view shows the game inside the screen of a chosen phone or tablet, including the notch and safe area (T47 · Mobile: Touch Input, Builds, Optimisation & Store Publishing).

How fast Play mode starts depends on the Enter Play Mode settings in Project Settings, covered in T01. T05 · Scripting in Unity: Lifecycle, Serialization, Coroutines & Awaitable explains what they mean for your scripts.

Working faster#

Selecting, hiding and locking#

  • Click selects; Ctrl-click adds or removes; drag a box in the Scene view to select everything inside it.
  • Clicking the same spot again in the Scene view cycles through overlapping objects. To pick from a list instead, hold Ctrl (macOS: Cmd) and right-click: the selection piercing menu lists everything under the cursor.
  • Scene visibility: the eye icon beside a GameObject in the Hierarchy (or H) hides it in the Scene view only. The game still has it. Use it to get the roof out of the way while you furnish a house.
  • Scene picking: the hand icon (or L) makes an object unclickable in the Scene view, so you stop grabbing the floor when you meant to grab the chair.
  • Alt-click the arrow beside a parent in the Hierarchy to expand or collapse everything under it.

Undo#

Ctrl+Z undoes and Ctrl+Y redoes (macOS: Cmd+Z and Cmd+Shift+Z). Edit > Undo History (also on the toolbar) lists every step, so you can jump back several at once. Undo covers what you do in the Editor; it doesn't cover changes your scripts make while playing, or files changed outside Unity. Git is your real safety net.

Shortcuts#

Edit > Shortcuts (macOS: Unity > Shortcuts) shows a keyboard map with every command and its binding. Search for a command to find its shortcut, or click a key on the map to see what it does. You can rebind anything, and save your bindings as a profile. When a shortcut in this handbook doesn't work for you, look it up here: a package or a previous change may have rebound it.

The new Hierarchy (preview)#

Guided build: Lighthouse Island#

You'll build a small island at dusk: a lighthouse whose lamp sweeps around, a few cottages, a ring of trees, a jetty and a boat that rocks on the water. Everything is made from primitives, so you need no art. On the way you'll use every part of this chapter: navigation, parenting and pivots, snapping, materials, prefabs, nesting, variants, overrides, Play mode and the scene list.

Allow about two hours. Save often (Ctrl+S), and commit to Git at the end of each step if you set it up in T01.

Step 1 · A scene and some folders#

  1. In the Project window, create the folders from Organising a project: _Project with Materials, Prefabs, Scenes and Scripts inside it.
  2. Right-click _Project/Scenes > Create > Scene, name it Island, and double-click it to open it. It starts with a camera and a light.
  3. Create five empty GameObjects at the root, named Environment, Buildings, Props, Lighting and Gameplay. Check each one is at (0, 0, 0). Drag the Directional Light into Lighting and the Main Camera into Gameplay.

These empties are folders. Every object you add from now on goes inside one of them, so the Hierarchy stays readable when the scene has two hundred objects in it.

Step 2 · Sea and island#

  1. Make four materials in _Project/Materials (Assets > Create > Material) and set their Base Map colours: Sea deep blue (smoothness 0.8), Sand pale yellow, Grass muted green, Rock grey.
  2. Create a Plane named Sea inside Environment. Position (0, 0, 0), scale (12, 1, 12): a plane is 10 × 10 units, so this is 120 m across. Drag the Sea material onto it.
  3. Create a Cylinder named Beach inside Environment, position (0, 0, 0), scale (34, 0.3, 34), with the Sand material. A cylinder is 2 tall, so its top is 0.3 above the sea.
  4. Duplicate it (Ctrl+D), rename the copy Meadow, scale (28, 0.5, 28), Grass material. Its top is at 0.5.
  5. Select Sea, Beach and Meadow and tick Static in the Inspector header. They'll never move.

Fly around it (right mouse + W A S D). Press F on Meadow and orbit. Check the island from below with the Orientation overlay: the plane vanishes, because planes only render from above.

Step 3 · The lighthouse, built from parts#

Build the lighthouse under an empty parent so that the whole thing moves as one, with its pivot on the ground.

  1. Create an empty named Lighthouse inside Buildings at (9, 0.5, 7): on top of the meadow, away from the middle.
  2. Add these children to it (create each, then drag it onto Lighthouse, then type its local values). Make materials White, Red and Lamp as you go.
ChildPrimitiveLocal positionScaleMaterial
TowerCylinder(0, 5, 0)(2.4, 5, 2.4)White
StripeLowCylinder(0, 3.5, 0)(2.45, 0.6, 2.45)Red
StripeHighCylinder(0, 7.5, 0)(2.45, 0.6, 2.45)Red
GalleryCylinder(0, 10.15, 0)(3.4, 0.15, 3.4)Rock
LampRoomCylinder(0, 11.1, 0)(1.6, 0.8, 1.6)Lamp
RoofSphere(0, 12.1, 0)(1.9, 1.2, 1.9)Red

The tower is a cylinder scaled to 5 on Y, so it's 10 m tall, and its centre is 5 above the parent, so its base sits exactly on the parent's pivot. Check that by selecting Lighthouse: the Move handle should be at the foot of the tower.

For the Lamp material, tick Emission and set its colour to a warm yellow, so the lamp room glows even in shadow.

  1. Now the part that turns. Create an empty child of Lighthouse named LampPivot at local (0, 11.1, 0). Give it two children:
    • Head: a Cube at local (0, 0, 0.9), scale (0.5, 0.4, 0.3), Lamp material. It pokes out of the lamp room and shows which way the lamp faces.
    • Beam: GameObject > Light > Spot Light, dragged onto LampPivot, at local (0, 0, 1.1) with rotation (25, 0, 0). A spot light shines along its Z axis, and the 25° tilts it down. Set Range to 60 and Spot Angle to 25, a warm colour, and raise Intensity until you can see its pool of light on the island and the sea.
  2. Select Beam and Ctrl+D. Set the copy's rotation to (25, 180, 0) and position to (0, 0, -1.1): a second beam pointing the other way, like a real two-sided lamp.
  1. Drag Lighthouse from the Hierarchy into _Project/Prefabs. It turns blue: it's now a prefab and this object is its first instance.

Step 4 · Two scripts that bring it to life#

Create two scripts in _Project/Scripts with Assets > Create > Scripting > MonoBehaviour Script, named exactly Spin and Bob. Open each, replace everything in it with the code below, and save. You don't need to understand the code yet; for now, notice that each [SerializeField] line becomes a setting you can change in the Inspector.

Spin.csUnity sandboxC#
using UnityEngine;

namespace Handbook.T02
{
    // Turns the GameObject at a steady speed. Used for the lighthouse lamp.
    public class Spin : MonoBehaviour
    {
        [SerializeField] Vector3 axis = Vector3.up;
        [SerializeField] float degreesPerSecond = 45f;
        [SerializeField] Space space = Space.Self;

        void Update()
        {
            // Time.deltaTime is the length of the last frame, so the speed is the same at any frame rate.
            transform.Rotate(axis, degreesPerSecond * Time.deltaTime, space);
        }
    }
}
Bob.csUnity sandboxC#
using UnityEngine;

namespace Handbook.T02
{
    // Moves the GameObject gently up and down around where it started, and rocks it, like a boat on water.
    public class Bob : MonoBehaviour
    {
        [SerializeField, Min(0f)] float height = 0.15f;
        [SerializeField, Min(0f)] float wavesPerSecond = 0.4f;
        [SerializeField, Range(0f, 20f)] float rockDegrees = 4f;

        Vector3 startPosition;
        Quaternion startRotation;
        float offset;

        void Start()
        {
            startPosition = transform.localPosition;
            startRotation = transform.localRotation;
            offset = Random.value * Mathf.PI * 2f;   // so two boats don't move in step
        }

        void Update()
        {
            float wave = Mathf.Sin(Time.time * wavesPerSecond * Mathf.PI * 2f + offset);
            transform.localPosition = startPosition + Vector3.up * (wave * height);
            transform.localRotation = startRotation * Quaternion.Euler(0f, 0f, wave * rockDegrees);
        }
    }
}

The namespace Handbook.T02 line keeps these scripts from clashing with anything else called Spin; you can keep it. If Unity shows an error in the Console, check that the file names match the class names exactly (Spin.cs contains class Spin).

  1. Double-click the Lighthouse prefab to open it in Prefab Mode (in isolation). Select LampPivot and drag Spin onto its Inspector. Leave the defaults: around its own up axis at 45° a second. Leave Prefab Mode with the back arrow. Every lighthouse you'll ever place now has a spinning lamp.
  2. Press Play. The beams sweep the island. While playing, change Degrees Per Second on LampPivot to 90 and watch it speed up. Stop. The value is back to 45, because that change was made on the scene instance during Play mode.

Step 5 · A cottage with a working door and a nested chimney#

First the chimney, as its own prefab, because cottages and other buildings will share it.

  1. Create an empty named Chimney anywhere. Children: Stack, a Cube at local (0, 0, 0) scale (0.6, 1.4, 0.6) with the Rock material, and Cap, a Cube at local (0, 0.75, 0) scale (0.75, 0.12, 0.75). Drag Chimney into Prefabs, then delete it from the scene.
  2. Create an empty named Cottage inside Buildings at (-3, 0.5, 1). Make materials Walls (cream), Roof (dark red) and Wood (brown). Add children:
ChildPrimitiveLocal positionRotationScale
WallsCube(0, 1.25, 0)(0, 0, 0)(4, 2.5, 5)
RoofLeftCube(-1.05, 3.2, 0)(0, 0, 35)(2.6, 0.15, 5.4)
RoofRightCube(1.05, 3.2, 0)(0, 0, -35)(2.6, 0.15, 5.4)

Look at the roof from the front with the Orientation overlay's Z arm and orthographic projection: the two panels lean together into a ridge. Each panel rotates around its own centre, which is why both need a position as well as an angle.

  1. The door, with a hinge. A cube rotates around its centre, but a door must swing on its edge. So create an empty child of Cottage named DoorHinge at local (-0.5, 0, 2.52): the bottom left corner of where the door goes, just in front of the wall. Give it a child Door, a Cube at local (0.5, 1, 0) scale (1, 2, 0.08) with the Wood material.
  2. Select DoorHinge, press E, and drag the green ring. The door swings on its hinge. Set its Y rotation back to 0.
  3. Drag the Chimney prefab onto Cottage in the Hierarchy so it becomes a child, at local (1.2, 3.6, -1.4). It pokes up through the right-hand roof panel.
  4. Drag Cottage into Prefabs. Unity asks nothing, because only the chimney inside was already a prefab: the chimney stays a nested prefab inside the new Cottage prefab.

Step 6 · A variant, and overrides#

  1. Right-click the Cottage prefab > Create > Prefab Variant, and name it Cottage_Fisher. Open it in Prefab Mode.
  2. Make a RoofBlue material and drag it onto both roof panels. Add a child Barrel (Cylinder, local (2.5, 0.5, 2), scale (0.7, 0.5, 0.7), Wood). These are the variant's overrides: look at the Inspector's blue bars and the plus badge on Barrel. Leave Prefab Mode.
  3. Place two Cottage_Fisher instances on the jetty side of the island, at about (-4, 0.5, -11) and (4, 0.5, -11), and one more plain Cottage at (3, 0.5, 2). Turn them as you like: rotate around Y with Ctrl held so it snaps in steps.
  4. Now test inheritance. Open the base Cottage prefab and change the Walls material colour, or swap Walls to a new material. Every cottage changes, variants included, because variants inherit what they don't override. The roofs of the fisher cottages stay blue, because that's overridden.
  5. Finally, an instance override. Select one plain cottage in the scene and rotate its DoorHinge to Y = -100, so its door stands open. Look at the Inspector: the rotation is in bold with a blue bar. Open the Overrides dropdown on the cottage to see it listed. Don't apply it. This one cottage has an open door; the prefab doesn't.

Step 7 · A ring of trees, placed with maths#

  1. Build a Tree prefab: an empty root, a Trunk (Cylinder, local (0, 1, 0), scale (0.3, 1, 0.3), Wood) and a Crown (Sphere, local (0, 2.6, 0), scale (1.8, 1.8, 1.8), a dark green material). Pivot on the ground again.
  2. Drag one Tree into Environment, then duplicate it until you have 13 trees. Select all 13.
  3. In the Transform, type cos(L(0,2*pi))*8 into Position X, sin(L(0,2*pi))*8 into Position Z, and 0.5 into Y. They form a circle of radius 8 around the centre, between the middle cottages and the outer buildings. The first and last tree land in the same spot (0 and 2π are the same angle), so delete one of those two.
  4. With the 12 still selected, type R(0,360) into Rotation Y and R(0.8,1.4) into Scale Y. Each tree gets a random turn and height, so the ring doesn't look stamped out.
  5. If a tree stands in a building, move it by hand or delete it. Mark the trees Static.

Step 8 · A jetty with vertex snapping, and a boat#

  1. Inside Props, create an empty Jetty at the island's edge, about (0, 0.3, -16). Add a Plank child: a Cube, scale (2, 0.12, 1), Wood.
  2. Duplicate the plank. With the copy selected and the Move tool active, hold V, hover over one of its corners, and drag it to the matching corner of the first plank. It clicks into place exactly edge to edge. Repeat until the jetty is six planks long, heading out to sea.
  3. Add a few posts (Cylinders scaled (0.2, 0.6, 0.2)) under the edges, using surface snapping (Shift+Ctrl while dragging) to stand them on the sea.
  4. Make a boat beside the jetty: an empty Boat at sea level, a Hull (Cube, local (0, 0.2, 0), scale (1.4, 0.4, 3.2)), a Mast (Cylinder, local (0, 1.4, 0.3), scale (0.08, 1, 0.08)), and a Sail (Cube, local (0, 1.5, -0.1), scale (0.04, 1.6, 1), white). This is the boat-and-mast hierarchy from the diagram above.
  5. Add the Bob component to Boat (not to the hull: you want the whole boat to rock). Duplicate the boat once and move the copy. Press Play: both boats rock, out of step with each other.

Step 9 · Dusk, and the shot#

  1. Select the Directional Light. Set its rotation to (10, -40, 0): a low sun. Give it a warm orange colour and lower its intensity a little. The sky changes with it.
  2. Inside one cottage, add a Point Light with a warm colour and a short range, placed just inside a wall, so the cottage glows. Apply it to the prefab if you want every cottage lit, or keep it as an override on this one.
  3. Fly the Scene view to a view you like: low, across the jetty, with the lighthouse behind. Select the Main Camera and press Ctrl+Shift+F (Align With View).
  4. In the Game view, set the aspect to 16:9. Press Play and watch for a while: lamp sweeping, boats rocking, warm windows.

Step 10 · Tidy, save, and add it to the build#

  1. Check every object is inside one of the five group objects. Collapse them all (Alt-click the arrows).
  2. Make sure the moving things aren't static: LampPivot and both boats must have Static unticked. (A static object that moves is a bug waiting to happen.)
  3. Save. Open File > Build Profiles and drag Island into the Scene List. Untick or remove the template's SampleScene, or drag Island to the top so it loads first.
  4. Commit: git add . and git commit -m "Lighthouse Island". Look at git status first: you should see your scene, prefabs, materials and scripts, each with a .meta file.

Going further#

A one-click scene structure#

If every scene should start with the same group objects, a few lines of editor code can add them for you. This tool adds a Handbook > T02 > Add Scene Groups menu item. It skips groups that already exist and supports undo. Put it in a folder named Editor (any folder called Editor is editor-only and never goes into a build). T17 · Editor Scripting & Custom Tools (IMGUI and UI Toolkit) teaches editor scripting properly.

Editor/SceneGroups.csUnity sandboxC#
using UnityEditor;
using UnityEngine;

namespace Handbook.T02.EditorTools
{
    // Adds the same top-level group objects to a scene, so every scene is organised the same way.
    public static class SceneGroups
    {
        static readonly string[] Groups = { "Environment", "Buildings", "Props", "Lighting", "Gameplay" };

        [MenuItem("Handbook/T02/Add Scene Groups")]
        static void AddGroups()
        {
            int added = 0;
            foreach (string groupName in Groups)
            {
                // A leading "/" only finds objects at the root of the Hierarchy.
                if (GameObject.Find("/" + groupName) != null)
                {
                    continue;
                }

                var group = new GameObject(groupName);
                Undo.RegisterCreatedObjectUndo(group, "Add Scene Groups");
                added++;
            }

            Debug.Log($"Scene groups: added {added}, {Groups.Length - added} already there.");
        }
    }
}

A scene template (above) does the same job without code. The tool is better when scenes already exist and you want to bring them in line.

Presets as team defaults#

In Project Settings > Preset Manager you can make a preset the default for a component type, optionally filtered by name. Every new Point Light then starts with your team's range and colour, and every imported texture whose name ends in _N gets normal-map settings. It's one of the cheapest ways to keep a project consistent.

How teams use prefabs#

  • Small prefabs, nested. A level built from a few hundred small prefabs (a wall section, a window, a lamp) is easier to change than one built from huge ones, and two people rarely edit the same file.
  • Scenes hold placement, prefabs hold content. If a scene has big trees of unique, unprefabbed objects, every change to them is a change to the scene file, and scene files are where merge conflicts hurt most.
  • Variants for families, overrides for one-offs. If you find yourself making the same override on many instances, that's a variant waiting to be made.
  • Watch the override count. Instances with dozens of overrides drift away from their prefab until nobody knows which values are real. The Overrides dropdown and Revert All are your clean-up tools.

Grey-boxing#

What you did in the guided build has a name: grey-boxing (or blocking out), building a level from simple shapes to test layout and scale before any art exists. Studios do it for every level. ProBuilder, a free Unity package, takes it much further, letting you model rooms, ramps and stairs directly in the Scene view. T29 · Level Design: Grey-Boxing, ProBuilder, Flow & Worldbuilding covers both.

Overlay and layout presets#

Overlays and layouts can both be saved. From the Overlays menu (`) choose Save Preset to keep an arrangement of Scene view tools for level building, another for lighting, and switch between them as you work.

Common mistakes & debugging#

"I can't see my object"#

  • It's hidden in the Scene view. Check the eye icon in the Hierarchy, and that scene visibility is on in View Options.
  • It's inactive, or one of its parents is. Faded names in the Hierarchy give it away.
  • It's far away or tiny. Select it in the Hierarchy and press F. Check its scale isn't 0 and its parent's scale isn't tiny.
  • You're looking at the back of a plane or quad. They only render from one side.
  • Its layer is hidden in the Scene view's View Options, or culled by the camera's Culling Mask in the Game view.
  • It's behind the camera, or outside its clipping planes (Game view only). Check Near and Far on the camera.

"I can't select it, or I keep selecting the wrong thing"#

  • Its pickability is off (the hand icon), or you keep grabbing something big in front of it. Turn off picking on the floor or the walls while you work.
  • Use the selection piercing menu (Ctrl + right-click) or click the object in the Hierarchy.
  • You're in Prefab Mode in context, where the rest of the scene is locked. Use the breadcrumbs to go back.

"My changes disappeared"#

  • You made them in Play mode. Use a Playmode tint, and Copy Component / Paste Component Values to carry values out.
  • You didn't save the scene, and opened another one or closed Unity. Look for the asterisk.
  • You changed an instance and then clicked Revert, or changed the prefab and the instance overrides that property (so your prefab change is hidden on that instance).

"It looks wrong"#

  • Magenta: the material's shader doesn't work in URP. Use the Render Pipeline Converter or switch it to URP/Lit.
  • Stretched or skewed children: a parent has non-uniform scale and the child is rotated. Scale the child (or the mesh) instead of the parent.
  • Everything changed colour, not just one object: you edited a shared material. Duplicate it for the one object.
  • The handle isn't where you expect: check Pivot / Center and Local / Global in Tool Settings.
  • The rotation numbers changed by themselves: Unity re-expressed the same rotation with different angles. It's the same rotation.

"The Editor is acting strangely"#

  • The Inspector won't change when I select things: it's locked (padlock).
  • A window has vanished: Window > General, or Window > Layouts > Default to reset.
  • I can't orbit: the Orientation overlay's padlock is on, or you're in 2D mode (View Options).
  • I can't add my script: the Console has a compile error, or the file name doesn't match the class name. Fix the first red error in the Console and the rest often go away.
  • A shortcut does nothing: the mouse is over a different window (most Scene shortcuts only work over the Scene view), or it has been rebound. Check Edit > Shortcuts.

Exercises#

1 · The flying test

In an empty scene, place six small spheres: one on top of a tall cylinder, one under a plane, one inside a closed box made of six cubes, one 200 m away, one behind a wall, and one at (0, 0, 0). Then, starting each time from a view of the whole scene, get a close look at each sphere as fast as you can, without using the Hierarchy. Time yourself, then do it again tomorrow.

Solution

The fastest route to each one combines a few moves: click (or Ctrl + right-click to pierce), F to frame, Alt-drag to orbit. The sphere in the box needs either a hidden wall (H on a cube), wireframe draw mode, or flythrough mode to fly inside. The one under the plane needs orbiting below it (the plane disappears from beneath). The far one is quickest with the Hierarchy and F in real work, which is exactly why you shouldn't use it here: the point is to make the camera controls automatic. Under 10 seconds per sphere is good.

2 · Which window?

For each task, name the window you'd use: (a) change a light's colour; (b) find every material in the project; (c) make the cottage a child of the island; (d) read why your script didn't compile; (e) see what the player will see; (f) change a texture's import size.

Solution

(a) Inspector, with the light selected. (b) Project window, searching t:Material (or Unity Search). (c) Hierarchy, dragging the cottage onto the island. (d) Console. (e) Game view. (f) Inspector, with the texture asset selected in the Project window, then Apply.

3 · Predict the world position

Work these out on paper, then check them in Unity by building them and reading the child's position after unparenting it (unparenting keeps the world position).

  1. Parent at (2, 0, 0), no rotation, scale 1. Child at local (1, 1, 0).
  2. Parent at (2, 0, 0), no rotation, scale 2. Child at local (1, 1, 0).
  3. Parent at (2, 0, 0), rotation (0, 90, 0), scale 1. Child at local (1, 0, 0).
Solution
  1. (3, 1, 0): just add the offsets.
  2. (4, 2, 0): the parent's scale stretches the child's offset too, so the offset becomes (2, 2, 0).
  3. (2, 0, -1). Turning 90° around Y (clockwise, seen from above) swings the parent's X axis round to point along world −Z, so one unit along the parent's X is one unit toward −Z. If you guessed (2, 0, 1), you turned the wrong way: in Unity, a positive Y rotation turns forward (+Z) toward right (+X), and right toward back (−Z). T06 · Game Maths: Vectors, Trigonometry, Matrices, Quaternions & Interpolation makes this precise.

4 · A treasure chest lid

Build a chest from cubes: a box and a lid. Make the lid open by rotating one object around the back edge of the box, so it swings up and back like a real lid. Then make it a prefab and place three, one open and two closed, without changing the prefab.

Solution

Add an empty LidHinge at the top back edge of the box (for a box centred on its pivot at local (0, 0.5, 0) with scale (1.2, 1, 0.8), that's local (0, 1, -0.4)). Make the lid a child of the hinge, positioned so its back edge sits on the hinge: local (0, 0.05, 0.4), scale (1.2, 0.1, 0.8). Rotate the hinge around X: −70° opens it. Make the chest a prefab; on one instance rotate its LidHinge. That's an instance override (bold, blue bar) and the prefab stays closed.

5 · The override detective

A teammate set Range to 8 on the Point Light inside the Cottage prefab. Four cottages in the scene got the new range, but two still have the old one. What happened, how do you confirm it, and how do you fix it without losing anything else on those two cottages?

Solution

Those two instances override the light's Range, so the prefab's value doesn't reach them. Confirm it by selecting each one: the light's Range is bold with a blue bar, and it appears in the cottage's Overrides dropdown. Fix it by right-clicking the Range property > Revert, which reverts only that property and keeps the cottage's other overrides. Don't use Revert All unless you've checked the list.

6 · A family of trees

From the guided build's Tree prefab, make two variants: Tree_Pine, whose crown is a tall capsule instead of a sphere, and Tree_Dead, which has no crown at all. Then change the base tree's trunk colour and check which trees change.

Solution

Tree_Pine: in the variant, disable or remove the sphere crown and add a Capsule child at the same height, scaled (1.2, 1.8, 1.2); or keep the crown object and swap its Mesh Filter's mesh to the capsule (one override instead of two). Tree_Dead: delete the crown in the variant; the Hierarchy shows it as a removed object override. Changing the base trunk colour changes all three, because neither variant overrides the trunk. That's the point of variants: shared parts stay shared.

7 · Stairs from one formula

Make a staircase of 12 steps, each 0.2 m high and 0.3 m deep, going up toward +Z, using one Cube and the Inspector's numeric functions. No step should be placed by hand.

Solution

Make one step (scale (1.2, 0.2, 0.3)), duplicate it to 12, select all 12, and type L(0.1,2.3) into Position Y and L(0,3.3) into Position Z. L spreads values evenly from the first to the last, so with 12 objects the step between them is (2.3 − 0.1) ÷ 11 = 0.2 in Y and 3.3 ÷ 11 = 0.3 in Z. The first step's centre is at 0.1 so it sits on the floor. If your steps come out in the wrong order, the selection order differs from the Hierarchy order; select them top to bottom in the Hierarchy.

8 · Split the island into two scenes

Split Lighthouse Island into Island_World (sea, beach, meadow, trees, buildings, lighting) and Island_Gameplay (camera, boats, and anything a player would interact with). Make them open together, make sure the lighting looks the same as before, and set up the scene list so both are in the build. Write two sentences on why a team might want this split.

Solution

Create the two scenes, open both (drag the second into the Hierarchy), and drag objects between the scene headers to move them. Lighting settings (sky, ambient, baking) are saved per scene and the active scene's are used, so make Island_World the active scene, or copy its Lighting settings to the other. Add both scenes to the scene list; at runtime the gameplay scene would be loaded additively by code (T10 · Your First Complete Game Loop: States, Scenes, UI, Audio & Builds). Why: an artist can light and dress Island_World while a designer tunes Island_Gameplay, and they never edit the same file, so there's nothing to merge.

Check yourself#

What is a GameObject with only a Transform?

  1. An error: every GameObject needs a Mesh Renderer
  2. An invisible collider
  3. An empty container with a position, useful as a folder, pivot or marker
  4. A prefab

Components give a GameObject its abilities. With only a Transform it has a place in the world and can have children, which is exactly what empties are for.

A parent is inactive. Its child's own active checkbox is ticked. Is the child running?

  1. Yes, because its own checkbox is ticked
  2. No: it's only active in the hierarchy when it and all its parents are active
  3. Only its scripts run
  4. Only in Play mode

activeSelf is the checkbox; activeInHierarchy is whether it really runs. Reactivate the parent and the child comes back on.

During Play mode you change the colour of a material in the Project window. What happens when you stop?

  1. The colour goes back
  2. Unity asks whether to keep it
  3. The material is deleted
  4. The new colour stays, because the material is an asset

Play mode only resets the scene. Assets such as materials, prefab assets and ScriptableObjects keep their changes.

An instance overrides a prefab's Speed value. You then change Speed on the prefab asset. What does the instance do?

  1. Keeps its overridden value
  2. Takes the new value
  3. Averages the two
  4. Becomes unpacked

An override always wins over the asset. Revert the override to make the instance follow the prefab again.

A child is at local position (0, 3, 0). Its parent is at (5, 0, 0) with no rotation and scale 1. Where is the child in the world?

  1. (0, 3, 0)
  2. (5, 0, 0)
  3. (5, 3, 0)
  4. (5, 3, 5)

With no rotation or scale on the parent, world = parent position + local offset.

Which tag makes Unity remove a GameObject and its children from builds?

  1. Untagged
  2. EditorOnly
  3. Finish
  4. GameController

EditorOnly objects exist in the Editor and are stripped when the game builds. Good for notes and helpers.

An object you imported shows up bright magenta. What's the most likely cause?

  1. It has no texture
  2. Its light is too bright
  3. It's selected
  4. Its material uses a shader the current render pipeline can't run

Magenta is Unity's "shader not supported" colour. Convert the material to URP.

Where do you choose which scenes are included when you build the game in Unity 6?

  1. The Scene List in File > Build Profiles
  2. The Hierarchy
  3. Project Settings > Player
  4. Every scene in the project is always included

Only scenes in the scene list are built, and the first one loads first. Older versions called this window Build Settings.

A door rotates around its middle instead of its edge. What's the usual fix?

  1. Scale it to 0 on one side
  2. Use the Rect tool
  3. Put an empty at the hinge, make the door its child, and rotate the empty
  4. Turn on Pivot mode

Objects rotate around their pivot. An empty parent gives you a pivot wherever you need one.

What does a prefab variant store?

  1. A full copy of its base prefab
  2. A link to its base prefab plus only the changes it makes
  3. Only its position in the scene
  4. Nothing until you unpack it

A variant inherits everything else from its base, so fixes to the base reach the variant automatically.

Cheat sheet#

Scene view

  • Right mouse + WASD QE: fly (scroll = speed)
  • Alt + left-drag: orbit
  • Middle-drag: pan · scroll: zoom
  • F: frame · Shift+F: follow
  • `: Overlays menu
  • Shift+Space: maximise window

Tools

  • Q view · W move · E rotate
  • R scale · T rect · Y transform
  • Z pivot/center · X local/global
  • Ctrl-drag: increment snap
  • V-drag: vertex snap
  • Shift+Ctrl-drag: surface snap

Hierarchy and objects

  • Ctrl+Shift+N: new empty
  • Alt+Shift+N: new empty child
  • Ctrl+Shift+G: empty parent
  • Ctrl+D: duplicate · F2: rename
  • H: hide · L: unpickable
  • Ctrl+Shift+F: align with view

Play and save

  • Ctrl+P: play / stop
  • Ctrl+Shift+P: pause
  • Ctrl+Alt+P: step a frame
  • Ctrl+S: save scene
  • Ctrl+K: search everything
  • Scene changes in Play mode are lost; asset changes are kept

Prefabs

  • Blue cube: prefab instance
  • Blue cube, grey side: variant
  • Blue bar / bold: override
  • Red name: missing prefab
  • Double-click asset: edit in isolation
  • P on instance: edit in context

Rules of thumb

  • 1 unit = 1 m; Y up; RGB = XYZ
  • Empty parents at (0,0,0), scale 1
  • Keep scale uniform; never 0
  • Move assets inside Unity only
  • Read the Overrides list before Apply All
  • Number fields take L(), R(), maths

Glossary#

Scene
An asset (.unity file) holding a set of GameObjects: a level, a menu, a test room.
GameObject
Anything in a scene. A container with a name and a Transform, given abilities by its components.
Component
A piece of functionality attached to a GameObject, such as a Mesh Renderer, Collider, Light or your own script.
Composition
Building objects by combining components rather than by inheriting from a type for each kind of object.
Transform
The component every GameObject has: position, rotation, scale and parent.
Hierarchy
The window listing the GameObjects in open scenes as a tree of parents and children.
Inspector
The window showing and editing the components and settings of the selected item.
Overlay
A floating, movable toolbar or panel inside the Scene view, such as Tools or Grid and Snap.
Primitive
A built-in shape: Cube, Sphere, Capsule, Cylinder, Plane or Quad.
Empty
A GameObject with only a Transform, used as a folder, pivot or marker.
Pivot
The point an object's position refers to, and which it rotates and scales around.
Local space
Positions and directions measured relative to a parent. What the Inspector shows for a child.
World space
Positions and directions measured from the scene's origin and axes.
Tag
One word attached to a GameObject so code can recognise it. Each GameObject has exactly one.
Layer
One of 32 groups that cameras, physics and raycasts can include or ignore.
Static
Flags saying a GameObject never moves at runtime, so systems like lighting and batching can precompute data for it.
Material
An asset describing how a surface looks: shader, colours, textures. Shared by every object that uses it.
Prefab
A GameObject saved as an asset, so it can be placed many times and changed in one place.
Prefab instance
A copy of a prefab in a scene, linked to the asset.
Override
A change on a prefab instance (or variant) that differs from its prefab, shown with a blue bar.
Nested prefab
A prefab instance inside another prefab, keeping its link to its own asset.
Prefab variant
A prefab based on another prefab, storing only its differences.
Prefab Mode
The editing mode for a prefab asset, opened in isolation or in context.
Play mode
Running the game inside the Editor. Scene changes made during it are undone when it stops.
Active scene
With several scenes open, the one new objects go into and whose lighting settings are used.
Build profile
A saved set of build settings for a platform, including the list of scenes to build.