In this part, we'll create a complete game with multiple levels, UI, and a start/end screen. This completes the core game from the original 3-part series.
1 Creating the Start Scene
- Go to your Scenes folder
- Create a new Scene called "Start"
- Add UI → Image (this creates a Canvas automatically)
- Hold Alt and click the stretch icon to fill the screen
- This white image will be our background
Adding the Title Text
- Add UI → Text
- Name it "Start Game"
- Set Width to 800, Height to 100
- Set Font Size to 80
- Center the alignment
- Add a custom font by creating a Fonts folder and importing your font
Scaling UI with Screen Size
- Select the Canvas
- Change UI Scale Mode from "Constant Pixel Size" to Scale With Screen Size
- Set Match to Height
Scale With Screen Size ensures your UI looks consistent across different screen resolutions.
2 Start Screen Logic
- Select your background Image (rename to "UI Background")
- Add a Script Machine component (Embedded)
- Add On Mouse Input event (Left Button, Down)
- Add Scene Manager Load Scene (by build index)
- Set the build index to 1
3 Setting Up Build Settings
- Rename "SampleScene" to "Level1"
- Go to File → Build Settings
- Drag your scenes in order:
- Start (index 0)
- Level1 (index 1)
4 Creating Prefabs
Before duplicating levels, convert objects to prefabs:
- Create a Prefabs folder
- Drag these objects into the folder:
- Coin
- Obstacle
- Finish
- Player
- Ground
For prefabs with Embedded graphs (like Coin), click Convert in the Script Machine to convert to a Graph asset. This ensures logic updates apply to all instances.
Creating a Level Base Prefab
- Create an empty GameObject called "Level Base"
- Add Camera, Light, and other scene essentials as children
- Save as a prefab for reuse across levels
5 Designing Multiple Levels
- Arrange obstacles and coins in Level1
- Save the scene
- Duplicate Level1 (Ctrl+D) to create Level2
- Open Level2 and modify the layout
- Use orthographic top-down view for easier level design (click Y axis, then center button)
- Repeat for Level3
To prevent accidentally selecting the ground, click the lock icon next to it in the Hierarchy to disable selection.
6 Loading the Next Level
Update the Player graph to load the next level instead of restarting:
- Open the Player prefab's graph
- Replace the restart logic with Scene Manager Load Scene (by build index)
- Get the current build index:
- Add Scene Manager Get Active Scene
- Add Scene Get Build Index
- Add Add unit (add 1 to the index)
- Connect to Load Scene
7 Creating the End Scene
- Duplicate the Start scene, rename to "End"
- Change the text to "Thanks for Playing"
- In the Script Machine, replace Load Scene with Application Quit
- Add the End scene to Build Settings (it should be the last index)
8 Displaying Coin Count
Creating the UI
- Open your Level Base prefab
- Add UI → Image (use a circle sprite for a coin icon)
- Color it yellow
- Anchor to top-left corner
- Add UI → Text as a child to display the count
Updating the Count
- Add a Script Machine to the text object
- On Start and Update, use Set Text
- Get the Saved Variable "Coins"
- Convert to string with Integer To String
- Connect to Set Text
9 Adding Fog
Add depth with fog:
- Go to Window → Rendering → Lighting
- Under Environment, enable Fog
- Set the fog color to match your background
- Adjust density to taste
- Repeat for each level scene
10 Building the Game
- Go to File → Build Settings
- Verify all scenes are added in the correct order
- Select your target platform
- Click Build and Run
- Choose a builds folder and wait for compilation
What's Next?
Congratulations! You've completed the core game. The bonus episodes cover:
- E04: Adding a Level Complete cutscene animation
- E05: Creating a coin shop to spend your collected coins