Unity Beginner Project: Build a 2D Top-Down Adventure Controller
In this guide you will build the foundation of a small 2D adventure game in Unity. By the end, you will have a player that moves smoothly, a camera that follows, collectible keys, and a locked gate that opens when the player has the key.
This is a good first Unity project because it teaches the loop used in many games:
Read player input.
Move a character through the world.
Detect nearby objects.
Change game state when something happens.
Give the player feedback.
What You Will Make
The final scene is simple but meaningful: a player explores a small room, picks up a key, walks to a gate, and opens it. You can later expand this into a dungeon, farming game, RPG town, or survival prototype.
Step 1: Create the Unity Project
Open Unity Hub and create a new project:
Template: 2D
Name: TopDownAdventure
Location: anywhere inside your projects folder
When the project opens, create these folders in the Project window:
TEXT
1Assets/2 Art/3 Prefabs/4 Scenes/5 Scripts/
Save the current scene as:
TEXT
1Assets/Scenes/Main.unity
You do not need polished art. Use simple colored squares for now. Beginners often get stuck searching for assets before they understand the system. Build the system first.
Step 2: Create the Player
In the Hierarchy:
Right-click and choose 2D Object > Sprites > Square.
Rename it to Player.
Set its color to blue in the Sprite Renderer.
Add a Rigidbody2D.
Add a CapsuleCollider2D or BoxCollider2D.
Set the Rigidbody2D:
Gravity Scale: 0
Freeze Rotation Z: enabled
Collision Detection: Continuous if your player moves fast
The player should not fall because this is a top-down game.
Step 3: Add Movement Code
Create a script named PlayerMovement.cs in Assets/Scripts.
Set the Player tag to Player, add a trigger collider to the exit, and attach the script.
You now have a complete tiny objective:
Explore.
Find key.
Unlock gate.
Reach exit.
Step 9: Beginner Debug Checklist
If something does not work, check these in order:
Is the script attached to the correct GameObject?
Is the collider set to trigger only when the script expects a trigger?
Does the player have the required component?
Is the Rigidbody2D on the moving object, not the wall?
Did you save the scene?
Is the GameObject active in the Hierarchy?
What To Add Next
Good next upgrades:
Add a UI text prompt instead of Debug.Log.
Add two keys and two gates.
Add a simple enemy that resets the room.
Add a coin counter.
Add scene loading when the player reaches the exit.
The important lesson is that Unity gameplay is usually many small components talking to each other. Keep each component responsible for one job, and your projects will stay easier to expand.