How To Make A Main Menu In Unity For Your First Game
what is this series about
In this series I will be discussing the process of how I made my first mobile application, Dr. Dino, giving you tips, tricks, and tutorials on how you can get started with game development.
If you want to check out the first game I ever created, click the button below:
In this post, we will discuss how to make a main menu for your first game.
hoiw to make a main menu
The C# Script
To make the main menu change between scenes in unity you have to use some form of C# script. Some important things that you should do is to call the “using UnityEngine.SceneManagement” function, which will allow you use Unity’s SceneManager.
Then you should make public methods for each individual scene you want to move to. Within each public method, you should include the “SceneManager.LoadScene(“YourScene”)” function. There are two ways to call the scene you want: you can use the literal name of the scene or its scene order, which can be found in the build settings of your game.
Below, you will find the exact script I used to make my first game, Dr. Dino.
Unity UI Buttons
After you make and debug the C# script there some other elements that must be included to make your main menu work. First you have to make a UI button through RightMouseButton> UI> Button. Then you should place the C# script onto the button and set the button to perform the method that you want when you press the button by adjusting the “OnClick()” method of the button.