Whenever Network.Connect
is called with the wrong password provided, the returned NetworkConnectionError
is NetworkConnectionError.NoError
. And then in the Unity Console it displays these two errors:
- “The remote system is using a password and has refused our connection because we did not set the correct password.”
- “The connection request to 192.168.1.200:25001 failed. Are you sure the server can be connected to?”
The returned value should be NetworkConnectionError.InvalidPassword
so that I can deal with the mistake. The Unity errors shouldn’t even be happening.
I am using the Network.Connect(guid, pw)
version to connect. If you provide the right password or set the server not to have a password, then everything works fine. I am testing on the same machine with a Build & Run instance and one in the Unity editor.
Update: I just tested with two builds just to rule it out and it has the the same result.
NetworkConnectionError connectError = Network.Connect(guid, pw);
if(connectError == NetworkConnectionError.NoError)
{
Debug.Log("Connected to Server"); // Always called even if the wrong password is provided.
}
else if(connectError == NetworkConnectionError.InvalidPassword)
{
Debug.Log("Invalid Password. Could not connect to server"); // Never gets called
}
What the heck is going on?