MultiplayerFPS-Tutorial
MultiplayerFPS-Tutorial copied to clipboard
Not being able to log in / register.
When I click the Log In or Register button, I get an error and it buffers forever. I'm using Unity 2018.2, and changed all of the DC's with DCF's and that's working fine. The issue is that in the script LoginMenu.cs , at line 146, a variable called "returned" is being created, but on the next line, it's null, I have added a little part to the script to Debug.LogError if the WWW variable is null, and it does. Does anyone know how to solve this issue?

Hello, It's been a while since I don't work with this project, but I still have it and working fine; so, I had to change some parts in order to make it work fine, this should fix your issue:
IEnumerator sendLoginRequest(string username, string password)
{
if (isDatabaseSetup == true)
{
IEnumerator e = DCF.Login(username, password);
while (e.MoveNext())
{
yield return e.Current;
}
//WWW returned = e.Current as WWW;
//if (returned.text== "Success")
string response = e.Current as string; // << The returned string from the request
if(response=="Success")
{
//Password was correct
blankErrors();
part = 2; //show logged in UI
//blank username field
input_login_username.text = ""; //password field is blanked at the end of this function, even when error is returned
UserAccountManager.instance.LogIn(username, password);
}
if (response == "UserError")
{
//Account with username not found in database
login_error.text = "Username not found";
part = 0; //back to login UI
}
if (response == "PassError")
{
//Account with username found, but password incorrect
part = 0; //back to login UI
login_error.text = "Incorrect Password";
}
if (response == "ContainsUnsupportedSymbol")
{
//One of the parameters contained a - symbol
part = 0; //back to login UI
login_error.text = "Unsupported Symbol '-'";
}
if (response == "Error")
{
//Account Not Created, another error occurred
part = 0; //back to login UI
login_error.text = "Database Error. Try again later.";
}
//blank password field
input_login_password.text = "";
}
}