Main menu not working

Hey, I have been taking help from a tutorial site how to make a menu.
I made a new scene that shall function as a menu and added a script to the camera that would supposedly make a menu. But nothing pops up when I start the game!

here’s the script:

using UnityEngine;
using System.Collections;

public class Menu : MonoBehaviour {

#region Fields

	private string instructionText = "Instructions: 

Move around with the arrow keys, when you think you have found that speciall place
in life…press space";
private int buttonWidth = 200;
private int buttonHeight = 50;

#endregion

	
// Use this for initialization
//void Start () {

//}

// Update is called once per frame
//void Update () {

//}

#region Functions


void OnGui ()
{
	GUI.Label(new Rect(10,10,200,200), instructionText);
	GUI.Button(new Rect(Screen.width / 2 - buttonWidth / 2, 200,buttonWidth, buttonHeight), "Start game");
		
	
}

#endregion

1 Answer

1

Nothing pops up, because the method called by the Unity engine is called OnGUI, not OnGui. See:

http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnGUI.html

You just need to capitalize those two letters.

Not to worry, we all miss banal stuff once in a while. ;)