Hi guys here’s my script but i cant enter words in my textfield and my back button does not work.Please help.Thanks
using UnityEngine;
using System.Collections;
public class MonoDevelop : MonoBehaviour {
private string CurMenu;
public string Name;
// Use this for initialization
void Start () {
CurMenu = "Main";
Name = PlayerPrefs.GetString("PlayerName");
}
// Update is called once per frame
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(){
if(GUI.Button(new Rect(0,0,128,32),"Back")){
ToMenu("Host");
}
}
}