Skip to main content

🏗️ Lesson 7.2: Building the Level

Let's construct the arena. This lesson is pure assembly — floor, walls, lighting, player, camera, and stars. Everything here is a skill you already have; now we combine them into a real level.

🎯 Learning Objectives

  • Build a floor and four boundary walls
  • Place the player and attach movement + follow camera
  • Scatter collectible prefabs around the arena
  • Organize the Hierarchy so the scene stays tidy

Estimated Time: 45 minutes

Project: A complete, walkable arena full of collectibles.

In This Lesson

The Target

By the end of this lesson your scene will look like this — a bright walled arena with the player and stars ready to collect:

A real Unity render of the finished arena: a walled floor with a blue player capsule and six yellow star collectibles.
Figure 1: The assembled arena (real render). Walls keep the player in; stars await collection.

Floor & Walls

  1. Floor: add a Plane, scale it to about (1.2, 1, 1.2). Give it a light material.
  2. Walls: add a Cube, scale it long and thin — e.g. (12, 1, 0.4) — and position it at one edge (Position Z ≈ 6, Y = 0.5). This is one wall.
  3. Duplicate the wall (Ctrl+D) three times; position one at each edge, rotating the two side walls 90°. A grey material suits them.
  4. Lighting: the scene's Directional Light already lights everything. Rotate it a little for pleasing shadows if you like.

✅ Pro Tip: duplicate, don't rebuild

Ctrl+D duplicates the selected object with all its components and settings. Build one wall perfectly, then duplicate — far faster and more consistent than making four from scratch.

Player & Camera

  1. Add a Capsule, position it at the centre (Y = 1), rename it Player, colour it, and tag it Player.
  2. Give it a Rigidbody (needed for star triggers). Under Constraints, freeze rotation X and Z so it can't tip over.
  3. Attach your PlayerMovement script (Module 4).
  4. Attach CameraFollow to the Main Camera and drag the Player into its Target slot (Module 4).
💡 Reuse, don't rewrite. The movement and camera scripts from Module 4 work here unchanged. Reusing your own code is exactly how real projects grow.

Scattering Stars

  1. Bring in your Collectible prefab (Module 5).
  2. Drag it into the arena 6 times, spreading the copies around the floor.
  3. Keep them inside the walls and off the very centre (where the player starts).

⚠️ Stars falling through / not collecting

Confirm each is a prefab instance with Is Trigger ON and the Collectible script, and that the Player has a Rigidbody and the "Player" tag. This is the same checklist from Module 5.

Keeping It Tidy

Scenes get cluttered fast. Group related objects under empty parent GameObjects so the Hierarchy stays readable:

graph TD S[Scene] --> E1[--- Environment ---
Floor, Walls] S --> E2[--- Gameplay ---
Player, Collectibles] S --> E3[--- Systems ---
GameManager, Music] S --> E4[Main Camera, Directional Light]

Create an empty GameObject (GameObject ▸ Create Empty), name it --- Environment ---, and drag the floor and walls under it. Future-you will thank present-you.

Hands-on Exercise

🏋️ Exercise: Build the arena

  1. Build the floor and four walls (duplicate the first wall).
  2. Add the tagged Player with Rigidbody, movement, and follow camera.
  3. Scatter 6 collectible prefabs.
  4. Press Play — drive around and collect every star. Walls should stop you; stars should vanish and score.
  5. Organize the Hierarchy into Environment / Gameplay / Systems groups.
💡 The player slips through the walls

Walls need colliders (Cubes have Box Colliders by default — don't tick Is Trigger on walls). If moving by Transform, the player can still push through at high speed; keep speed reasonable, or move the player with physics.

🎯 Quick Quiz

Question 1: What's the fastest way to make four matching walls?

Question 2: Why group objects under empty parents in the Hierarchy?

Summary

🎉 Key Takeaways

  • Build the floor and duplicate one wall into four (Ctrl+D).
  • Add a tagged Player with Rigidbody + movement + follow camera (reused from Module 4).
  • Scatter your Collectible prefab around the arena.
  • Group objects under empty parents to keep the Hierarchy tidy.

🚀 What's Next?

You can collect stars, but the game never ends. Lesson 7.3 adds win and lose conditions — a real finish line.

🎉 The arena is alive!