Unity network says connected but .isClient is false.

Has anyone encountered this issue before or know a correct solution?

My server is created fine and establishes a connection with the master server and all is well. However, when I connected to my sever I get the ok debug message from Unity saying, “Running as client. No player ID set yet.
UnityEngine.Network:Connect(HostData)
Connected to 192.168.1.140:25000”

When I do a check on Network.isClient right after that, it returns false.

The only thing I can think of, is that it’s trying to hit port 25000, and it’s closed. It will come back positive if you’re targeting your local IP or using localhost, so make sure your port is open, I suppose.

I seem to have the same problem with you. I’ve setup a local master server and i’ve connected one of the clients to it.

When i try to reach the game server with the client, it says that it was connected successfully to the host but as you said bool Network.isClient was set to false.

I did some research on this and i realised that it is working but only for a very short time. I really cannot indicate the reason why it disconnects because there is no error at all.

Speaking of Firewall, i have allowed access to every port. So that shouldn’t be the case.

Here is what’s going on at the local masterserver:

I will come back if i find a solution to this.

Edit: The reason why it closes with out any at all is because actually there is one and that is, it does not know what to do next so it closes. In order to prevent it from closing you have to do something with OnPlayerConnected() function. If that function is not there, when the client joins the server, the server does not know what to do next and closes the connection. I do not think that this is bug but i think that it should print some information when you enable the network debugger.

At least this fixed the issue for me. I know that this question was old but i am leaving my solution here for people who could be in similar situation.

I have the solution for this problem.

Edit >> Project Settings >> Player -->>> Run In Background (Make sure that this option is checked)

I had the same problem, after checking “Run In Background” all worked fine but i dont know the actual reason.