Help Please Unexpected Symbol "}"

Im trying to set up this multiplayer menu and it popped up saying theres an error but i cant see one can someone help me please :slight_smile:

using UnityEngine;
using System.Collections;

public class MenuManager : MonoBehaviour
{
public string CurrentMenu;

public string MatchName;

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()
{

GUI.Button(new Rect(10,10,200,50), “Host Game”);
{
NavigateTo(“Host”);
}

}

private void Menu_HostGame()
{

GUI.Button(new Rect(10,10,200,50), “Back”);
{
NavigateTo(“Main”);
}

GUI.Button(new Rect(10,60,200,50), “Start Server”);
{
NavigateTo(“Main”);
}
GUI.TextField(new Rect(220, 10, 200, 30),

Errors here}

private void Menu_Lobby()
{

}

}

using UnityEngine;
using System.Collections;

public class MenuManager : MonoBehaviour
{
    public string CurrentMenu;
    public string MatchName;

    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()
    {
        if(GUI.Button(new Rect(10,10,200,50), "Host Game")) //GUI.Button if a method that returns a bool, needs an if block.
        {
            NavigateTo("Host");
        }
    }

    private void Menu_HostGame()
    {
        if(GUI.Button(new Rect(10,10,200,50), "Back")) //Again... the if.
        {
            NavigateTo("Main");
        }

        if(GUI.Button(new Rect(10,60,200,50), "Start Server"))
        {
            NavigateTo("Main");
        }
        GUI.TextField(new Rect(220, 10, 200, 30),"Text here" ) //There was a comma here, we both missed it! :)
    }

    private void Menu_Lobby()
    {
    }
}

Properly formatting your code is very important, it allows you to find missing curly braces and such much easier.

Also, read up on if blocks and the GUI.Button method:

If-Statement(so SO important to learn!)

GUI.Button

Ummm its still there
any idea why ?

I found it, it was a sneaky comma :P. I’ve updated the code above.

thanks dude but its still showing up

Copy and pasting that code works fine for me. Make sure you copy it verbatim

what do you mean ?

I said what I mean… There’s no other way to put it. The code I posted here works perfectly for me, generating no errors. Check the error that’s being generated, make sure it’s the same one.

These are the three errors that occur

Assets/AS Assets/Character Controllers/Sources/Scripts/ThirdPersonController.js(193,54): UCW0003: WARNING: Bitwise operation ‘|’ on boolean values won’t shortcut. Did you mean ‘||’?

Assets/Scripts/MenuManager.cs(107,1): error CS8025: Parsing error

Assets/Scripts/MenuManager.cs(97,5): error CS1525: Unexpected symbol `}’