- Home /
Error cs0103 name CurMenu does not exist
i need help i get this error cs0103 The Name CurMenu does not exist ,i'm working on the GUI
my script :
using UnityEngine;
using System.Collections;
public class Menu : MonoBehaviour {
private string CutMenu;
public string Name;
// Use this for initialization
void Start () {
CutMenu = "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,182,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("Main");
}
}
}
Any HELP?
Comment
Answer by gjf · Nov 16, 2014 at 02:34 PM
the error is telling you exactly what the problem is.
programming is about attention to detail and being specific.
if you spell something as 'CutMenu' when you define it, don't expect the compiler to assume that 'CurMenu' is the same thing...
Answer by 767_2 · Nov 16, 2014 at 06:27 PM
you got typo problem make these changes
private string CurMenu;
CurMenu = "Main";
Your answer
Follow this Question
Related Questions
Script compile errors with following hack & slash tutorial 2 Answers
CS0103 error when building scenes 0 Answers
CS0103 Error 1 Answer
Accessing a js static var from a c# script 1 Answer
MonoDevelop #if causes issue with code completion context 0 Answers