Creating a Main Menu with Unity UI
3 min readJul 8, 2021
Let’s make a simple Main Menu suitable for any game!
Add a Canvas and Panel to start:
Rename and set an image (sprite) for the background (the panel):
You may want to change what the Main Camera displays in the background:
Add some buttons:
Rename and change the text:
Add a title image or text:
Set the image, move the menu elements, and scale the image up:
Let’s see the result so far!
Now let’s make the buttons functional:
Now in Visual Studio (or equivalent), write the code for the functions:
Now connect the buttons to the code from the Inspector:
Lastly, set the canvas to fit the screen, regardless of resolution:
If Canvas elements are moving weirdly when you scale the Game window, try this:
Make sure the anchor preset is set to the correct position for each Canvas element. Choose the preset based on which part of the screen the element should be positioned relative to. Alt-Click to snap to that position.