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 MenuManager : MonoBehaviour
{
public string CurrentMenu;
void Start()
{
CurrentMenu = "main";
}
void OnGui()
{
if(CurrentMenu == "main")
Menu_Main();
if(CurrentMenu == "Lobby")
Menu_Lobby();
if(CurrentMenu == "Host")
Menu_HostGame();
}
public void NavigateTo(string nextmenu)
{
CurrentMenu = nextmenu;
}
private void Menu_Main()
{
//Main Menu Buttons
if (GUI.Button(new Rect(10, 10, 200, 50), "Host Game"))
{
NavigateTo("Host");
}
}
private void Menu_HostGame()
{
//Buttons for Hosting
if (GUI.Button(new Rect(10, 10, 200, 50), "Back"))
{
NavigateTo("main");
}
if (GUI.Button(new Rect(10, 60, 200, 50), "Start Match"))
{
}
}
private void Menu_Lobby()
{
}
}