Hi guys anybody know why im getting this error?
FormatException: Input string was not in the correct format
System.Int32.Parse (System.String s) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Int32.cs:629)
InternetCalls+c__Iterator2.MoveNext () (at Assets/Scripts/Level/InternetCalls.cs:85)
This is my script but i dont think that the string is in wrong format.
public class InternetCalls : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void DoLogin(string User,string Pass)
{
WWWForm www = new WWWForm ();
www.AddField ("user", User);
www.AddField ("password", Pass);
WWW w = new WWW ("http://reactivestudios.comuv.com/login.php", www);
StartCoroutine (Login(w, User));
GetXp (User);
}
public void DoRegister(string User,string Pass, string Name)
{
WWWForm www = new WWWForm ();
www.AddField ("user", User);
www.AddField ("password", Pass);
www.AddField ("name", Name);
WWW w = new WWW ("http://reactivestudios.comuv.com/register.php", www);
StartCoroutine (Reg(w));
}
IEnumerator Reg (WWW w)
{
yield return w;
if(w.error == null)
{
//PlayerPrefs.SetString("name", User);
Debug.Log ("Working");
Debug.Log (w.text.ToString());
}
}
IEnumerator Login (WWW w, string User)
{
yield return w;
if(w.error == null)
{
if(w.text == "login-SUCCESS")
{
PlayerPrefs.SetString("name",User);
Debug.Log ("Working");
Application.LoadLevel(1);
}
}
else
{
Debug.Log ("Error:" + w.error.ToString());
}
}
public void GetXp(string User)
{
WWWForm www = new WWWForm ();
www.AddField ("user", User);
WWW w = new WWW ("www.reactivestudios.comuv.com/Exp.php",www);
StartCoroutine (Xp (w));
Debug.Log ("Got Exp");
}
IEnumerator Xp(WWW w)
{
yield return w;
if(w.error == null)
{
//PlayerPrefs.SetString("name", User);
Debug.Log ("Getting Xp for Stats");
Debug.Log (w.text);
Debug.Log ("Working Stats");
PlayerPrefs.SetInt("xp",int.Parse(w.text));
Debug.Log ("Get xp Worked Stats");
}
else
{
Debug.Log ("Error: " + w.error.ToString());
}
}
}