uiTitle

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.
Menu01

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

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

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.
Menu05

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

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.
Menu07
This is displayed as arrows in the scene window.
Menu08

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

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.

JS

#pragma strict

function StartGame () 
{

     Application.LoadLevel(1);
}

function QuitGame () 
{

     Application.Quit();
}

C#

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

public class menuControl : MonoBehaviour {

    
    void StartGame () {
        Application.LoadLevel(1);
        
    }
    
     
    void QuitGame () {
        Application.Quit();
        
    }
}

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.
Menu010

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.