OnClientConnect is not called in NetworkManager

The client NetworkManager gets OnStartClient() but doesn’t seem to ever get OnClientConnect(). The server is getting the OnServerConnect() response before that but never gets OnServerAddPlayer() after calling either ClientScene.Ready(client.connection) or ClientScene.AddPlayer(client.connection, (short)0). These functions all seem to work fine when I’m running off of a single host with the second player added to the host client. Also of note, I’m getting a log about OnClientConnectInternal when I turn up the logs to developer mode, but still no call to OnClientConnect().

I’ve been porting some networking code from Unity 4 and went up to 5.2 for the ClientAuthority features. I had basic stuff working in 5.1, but at some point I stopped receiving Client ready messages on the server. I have barebones custom NetworkManager and am just using the base version with extra logs statements and some (removed) keyboard shortcuts for running off of a single machine.

public class MyNetworkManager : NetworkManager {
  public override void OnClientConnect(NetworkConnection conn)
  {
    Debug.Log("MyNetworkManager::OnClientConnect("+conn+")");
    base.OnClientConnect(conn);
  }
}

And I’m largely controlling the logic through the NetworkManagerHUD component.

So the root cause turned out to be that Time.timeScale was 0.0f. I don’t know why this breaks the network code. However, if you end up having this problem as well, try throwing a Time.timeScale = 1.0f; in a Start function somewhere.

But the doc doesn’t description the detial about

base.OnClientConnect(conn);

must be involked in

public override void OnClientConnect(NetworkConnection conn) {}

I think UNet is a beta version for now (Unity3D 5.3) and lots bugs need to be fixed.