Error (501457)

Heloo Guys II have problem with my Menu Script it says : Assets/Scripts/MenuManager.cs(47,33): error CS1502: The best overloaded method match for `UnityEngine.GUI.TextField(UnityEngine.Rect, string)’ has some invalid arguments

When i start game it shoud apear my buttons or. Menu for FPS game and it dosent show anythyning. Here’s Code

       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,60,200, 50), "Host Game");

        {

            NavigateTo("Host");

        }

}

   

    private void Menu_HostGame()

    {

        //Buttons Host Game

        if(GUI.Button(new Rect(10, 10, 200, 50), "Back"))

        {

        NavigateTo("Main"); 

        }

       

        if(GUI.Button(new Rect(10, 60, 200, 50), "Start Server"))

        {

           

        }   

            GUI.Label(new Rect(220, 10, 130, 30), "Match Name");

        MatchName = GUI.TextField(new Rect(400, 10, 200, 30), MatchName);

           

        }

   

    private void Menu_Lobby()

    {

       

    }

}

Which line is the actual error on, since you didn’t post the whole script we can’t see which line.

In the post, I’m guessing it’s line 77. But, since you didn’t post the entire script, the only thing I can imagine is that the variable MatchName isn’t defined as a string.

this GUI.Button(new Rect(10,60,200, 50), “Host Game”); should be inside an if structure.

Please use proper titles for threads in the future. The word Error as title is useless and very non-informative.