In this tutorial we will look at how to set up a simple menu with a start game and quit game button. 

Step 1:
Create a canvas to hold all our UI elements. GameObject > UI > Canvas. 

Step 2:
Add a button in the same way GameObject > UI > Button. Youe set up should look like this in the Hierarchy window.

Step 3:
Open up the Button to show its children and edoit the text in the inspector to say Start Game.

Set the Pos X & Pos Y to 0 to place the button in the centre of the screen.
It should look like this...

Step 4:
Now we can edit the button display.. Leave the transition on color tint and change the colors displayed when you highlight and press the button.

Step 5:
Now duplicate the button, change the text to Quit Game and move it below the start game button.

Step 6:
If you are using a controller then we need to set up the flow of the menu so that you can move between the buttons. To do this first select a button and click visualize in the inspector to show the flow of the menu.
This is displayed as arrows in the scene window.

Now select the EventSystem in the Hierarchy window and insert the button you wish to be selected first in the First Selected slot.

Now all we need to do is set up the Submit button in the Input settings a guide is here

Step 7:
The final step is creating a script to load another scene or quit the game. Create a script called menuControl and add the script below. Attach this script to the canvas.


#pragma strict

function StartGame () 


function QuitGame () 



using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class menuControl : MonoBehaviour {

    void StartGame () {
    void QuitGame () {

Step 8:
Select the start button in the Hierarchy window. Then in the inspector click the plus icon below the On Click() panel. Drag the canvas with the script attached into the slot shown below. Then select menuControl and StartGame from the function drop down. Repeat this process for the quit button, but select the QuitGame function instead.

Casino Bet 365 is best casino in the world.

What's Next

Next up for Unity Snippets is a look at game development articles from across the web...

Free Templates - bigtheme.net
Popular Art Betting make bookies articles.