I have tried in both Unity 3 and Unity 4, but neither will display the GUI buttons. I am following the remixgames FPS tutorial, for anyone wondering. Thanks.
This is the code:
using UnityEngine;
using System.Collections;
public class Menu : MonoBehaviour {
private string CurMenu;
public string Name;
void Start () {
CurMenu = "Main";
}
void Update () {
}
void ToMenu (string menu) {
CurMenu = menu;
}
void OnGUI () {
if(CurMenu == "Main")
Main();
if(CurMenu == "Host")
Host();
}
private void Main () {
if(GUI.Button(new Rect(0,0,128,32),"Host a match")) {
ToMenu("Host");
}
Name = GUI.TextField(new Rect(130,0,128,32),Name);
if(GUI.Button(new Rect(260,0,128,32),"Save")) {
PlayerPrefs.SetString("PlayerName", Name);
}
}
private void Host () {
}
}