2 Errors Occur please help newb :)

hey guys ive had some problems and ive fixed them but these i have no idea theres 2 errors here they are :

Assets/Scripts/MenuManager.cs(103,37): error CS1503: Argument #3' cannot convert string’ expression to type `char’

Assets/Scripts/MenuManager.cs(103,37): error CS1502: The best overloaded method match for `UnityEngine.GUI.PasswordField(UnityEngine.Rect, string, char)’ has some invalid arguments

Here is my code :

using UnityEngine;

using System.Collections;

public class MenuManager : MonoBehaviour

{

public string CurrentMenu;

public string MatchName = “Welcome”;

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”)) //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”))

{

}

GUI.Label(new Rect(220, 10, 130, 30), “MatchName”);
MatchName = GUI.TextField(new Rect(220, 10, 200, 30), MatchName);

GUI.Label(new Rect(220, 50, 130, 30), “MatchPassword”);
MatchPassword = GUI.PasswordField(new Rect(400, 50, 200, 30), MatchPassword,“*”);

}

private void Menu_Lobby()

{

}

}

First of all…

Secondly:

"*" // this is a string
'*' // this is a char (only works in C#)
"*"[0] // this is also a char

Hope that helps. :slight_smile:

another error could you have a look please :slight_smile:

FormatException: Input string was not in the correct format
System.Int32.Parse (System.String s)
MenuManager.Menu_HostGame () (at Assets/Scripts/MenuManager.cs:109)
MenuManager.OnGUI () (at Assets/Scripts/MenuManager.cs:44)

using UnityEngine;

using System.Collections;

 

public class MenuManager : MonoBehaviour

{

    public string CurrentMenu;

    public string MatchName = "Welcome";
	
	public string MatchPassword = "";
	
	public int MatchMaxPlayers = 32;
 

    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"))

        {

         

        }
		
		
		GUI.Label(new Rect(220, 10, 130, 30), "MatchName");
		MatchName = GUI.TextField(new Rect(400, 10, 200, 30), MatchName);
		
		
		GUI.Label(new Rect(220, 50, 130, 30), "MatchPassword");
		MatchPassword = GUI.PasswordField(new Rect(400, 50, 200, 30), MatchPassword,'*');
		
		
		GUI.Label(new Rect(220, 90, 130, 30), "Match Max Players");
		GUI.Label(new Rect(400, 90, 200, 30), MatchMaxPlayers.ToString());
		MatchMaxPlayers = Mathf.Clamp(MatchMaxPlayers, 8, 32);
		
		
		if(GUI.Button(new Rect(425, 90, 25, 20), "+"))
			MatchMaxPlayers += 2;
		if(GUI.Button(new Rect(450, 90, 25, 20), "-"))
			MatchMaxPlayers -= 2;
	
    
	
	}

    private void Menu_Lobby()

    {

    }

}