So my game works 100% fine in the Editor. But when I build it, and run it, it crashes (at a certain point, not directly after opening the game). It crashes when I press my Login button, which runs the following code:
try
{
ConnectionInfo info = new ConnectionInfo("127.0.0.1", 8886);
TCPConnection connection = TCPConnection.GetConnection(info);
string response = connection.SendReceiveObject("LoginInfo", "LoginRecieve", 1000, playerUsername + ":" + playerPassword);
if (response == "Success")
{
//Username and Password were correct. Stop showing 'Loading...' and show the LoggedIn UI. And set the text to display the username.
UserAccountManager.instance.LogIn(playerUsername, playerPassword);
ResetAllUIElements();
loadingParent.gameObject.SetActive(false);
}
else
{
//Something went wrong logging in. Stop showing 'Loading...' and go back to LoginUI
loadingParent.gameObject.SetActive(false);
loginParent.gameObject.SetActive(true);
if (response == "UserNotFound")
{
//The Username was wrong so display relevent error message
Login_ErrorText.text = "Error: Username not Found";
}
else
{
if (response == "InvalidPassword")
{
//The Password was wrong so display relevent error message
Login_ErrorText.text = "Error: Password Incorrect";
}
else
{
//There was another error. This error message should never appear, but is here just in case.
Login_ErrorText.text = "Error: Unknown Error. Please try again later.";
}
}
}
}
catch(Exception e)
{
Login_ErrorText.text = e.Message;
}
The game crashes with this error:
![alt text][1]
I do use NetworkCommsDotNet, and it may be a problem.
This is my log:
https://cdn.discordapp.com/attachments/284162864632299522/372726341742755840/error.log
Thanks in advance!
[1]: https://cdn.discordapp.com/attachments/284162864632299522/372699586038464512/Capture.PNG
↧