Error CS1041: Identifier expected

This is my script and cant seem to find the problem:/

using UnityEngine;
using System.Collections;

public class Menu : MonoBehaviour {

private string CurMenu;
// Use this for initialization
void Start () {

}

// 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(GUILayout.Button(“Host a match”))
ToMenu(“Host”);
}

private void Host(){

}
}

Welcome to the forum!

Please use code tags as it makes the code much more readable:
http://forum.unity3d.com/threads/143875-Using-code-tags-properly

Like that you can also point us to the line where the issue happens.

using UnityEngine;
using System.Collections;

public class Menu : MonoBehaviour {

private string CurMenu;
// Use this for initialization
void Start () {

}

// 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(GUILayout.Button("Host a match"))
ToMenu("Host");
}

private void Host(){


} 
}

Fixed that for you :slight_smile:

Now take a good look at line no. 19

line 17
void ToMenu(string menu}

you are closing this with a } it should be )

using UnityEngine;
using System.Collections;

public class Menu : MonoBehaviour {

private string CurMenu;
// Use this for initialization
void Start () {

}

// 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(GUILayout.Button("Host a match"))
        ToMenu("Host");
}

private void Host() {

} 

}

Having it tabbed nicely also helps in reading and finding syntax bugs. As people have said though, line 17 uses } instead of ) and line 19 should be} instead of {