- Home /
Error CS1502 Help!
Can someone please help me with this script. I've been following the tutorials for a multiplayer fps and I'm not sure how to fix it. Can someone please help!?! This is the error I got Assets/Scripts/MenuManager.cs(55, 37): error CS1502: The best overloaded method match for 'UnityEngine.GUI.Password Field(UnityEngine.Rect, string, char)' has some invalid arguments
using UnityEngine; using System.Collections;
public class MenuManager : MonoBehaviour { public string CurrentMenu;
  public string MatchName = "";
  public string MatchPassword = "";
 
  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"))
     {
         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, 230, 30), "Match Name");
     MatchName = GUI.TextField(new Rect(400, 10, 200, 30), MatchName);
     
     GUI.Label(new Rect (220, 50, 230, 30), "Match Password");
     MatchPassword = GUI.PasswordField(new Rect(400, 50, 200, 30), MatchPassword, "*");
 }
 
 private void Menu_Lobby()
 {
     
 }
}
Answer by paulaceccon · Jan 17, 2013 at 11:30 PM
The problem is here:
MatchPassword = GUI.PasswordField(new Rect(400, 50, 200, 30), MatchPassword, "*");
You have to pass a Rect (new Rect(400, 50, 200, 30) -- > ok), a string (ok) and a char (I guess you mean '*', with single quotes)
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Error CS1502 help! 1 Answer
Multiplayer Script error 2 Answers
Expecting ':' Found '=' Error 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                