In the game, there will be three playable levels and a main menu. The main menu will have three buttons on it: one to play the game, one for options, and a final one to exit the game.
Create a new scene and name it Main Menu
. Next, drag the Audio_Config
, Video_Config
, and Config_GUI
scripts to the main camera. These will be used for our Options menu. Next, create a new C# script, name it MainMenu
, and add this code to it:
void OnGUI() { if(GetComponent<Config_GUI>().optionsGUI == false) { if(GUI.Button(new Rect(700, 400, 150, 50), "Play Game")) Application.LoadLevel("Chapter 10_a"); if(GUI.Button(new Rect(700, 475, 150, 50), "Options")) GetComponent<Config_GUI>().optionsGUI = true; if(GUI.Button(new Rect(700, 550, 150, 50), "Quit Game")) Application.Quit(); } GetComponent<Config_GUI>().OnGUI(); }
For this script, all that you will need is the OnGUI
function. This code will create a few buttons that will...