Simple Main Menu

At home today i created a simple main menu in Unity 5, with some functioning buttons

Unity 1.png
This shows the creation of the UI buttons (with text) on a blue canvas.
Unity 2.png
This is the actual game, you can see that the other buttons and text have disappeared.
Unity 3.png
When i clicked on the “Options” button, it gave me a new set of buttons, which allows allows me to turn the sound on and off and return to the main screen.

The coding of the script is this.

I also had to add”using UnityEngine.UI; ” to give me more options in the code.

{
public Canvas MainCanvas;
public Canvas OptionsCanvas;

void Awake()
{
OptionsCanvas.enabled = false;
}

public void OptionsOn()
{
OptionsCanvas.enabled = true;
MainCanvas.enabled = false;
}
public void ReturnOn()
{
OptionsCanvas.enabled = false;
MainCanvas.enabled = true;
}

public void LoadOn()
{
Application.LoadLevel(1);
}
}

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s