Framework 1: Level Refinement

Creating a Menu page and working with multiple scenes

Now that we have the core bases within our game completed, it is time to add some game progression by adding an Menu stage and a future Stage 2 which showcases the actual game play.

Objective: To create an Main Menu Page and several scripts to control Level accession.

Preparing the setup:

We want to first create a empty trigger object at the end of our stage, this will allow the player to travel to the next level/scene once they come in contact at the end of the stage. Make sure that the box collider has the setting “Is Trigger” checked.

The empty box collider that will trigger the next level.

Next we are going to create a C# script called “Trigger Next Level” which will handle the on Trigger events. Before we start scripting we are also going to create a new “Scene” which we will name “Menu”. This will be the main screen that players are introduced to before starting the level.

On this menu scene, I just have a simple UI Button which has the text “Play”. We will add the graphics later. Next we are going to create our 2nd C# script which will handle the scene management for the Button.

To test whenever our load manager is working we will need to make sure that both scenes “Menu” and “Stage1” are within are Build. Go to File > Build Settings to bring up the Build settings. Here are able to see all the active scenes that will be part of the build. If there is nothing, we can simply drag and drop the scene file from the project window into the Build settings.

Make sure that the Menu Scene is top first, then Stage 1


For both scripts, we are going to be using the Unity Scene Manage library, therefore before we start with any functions we first need access to that library.

The Start Button

The Start button behavior is going to be very simple, we are going to make a public method which contains a load scene function. The index which we are going to load to is going to be 1, since in our build settings, index 1 is set to Stage 1.

Back in Unity, we are going to make the Canvas hold the Button script, and in the button object we are going to drag and drop the Canvas on the Button “On Click” parameter. Then select the public method as the condition when we press the button.

The Level Trigger

The End Level Trigger is going to be very similar to the button script where we will also use the scene manager to load the next scene. The only difference is that this will be an On Trigger Enter event instead of an public method.

For this example, we will set the load scene to Index 0 so we can just test to make sure that the Scene Manager is working. Attach the script to the empty box collider.

Back in Unity, everything should be working naturally.

From Main Menu to game play
And from Game play to Main Menu



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simon Truong

Simon Truong

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.