Creating UI Buttons to move between scenes
As well as scenes where the player plays the game, most games will have menu screens, which display to the user messages about instructions, high scores, the level they have reached so far, and so on. Unity provides UI Buttons to offer users a simple way to indicate their choices.
In this recipe, we'll create a very simple game consisting of two screens, each with a button to load the other one, as illustrated in the screenshot:

How to do it...
To create a button-navigable multi-scene game, follow these steps:
- Create a new Unity 2D project.
- Save the current (empty) scene, in a new folder,
_Scenes
, naming the scenepage1.
- Add a UI Textobject positioned at the top center of the scene, containing large white text that says
Main Menu (page 1)
. - Add a UI Button to the scene positioned in the middle-center of the screen. In the Hierarchy, click on the show children triangle to display the Text child of this GameObject button. Select the Text GameObject, and...