Issues with setting ClientScene.Ready after a scene change

After changing scenes on a single player host, I ran into an issue where calling ClientScene.Ready followed by NetworkServer.SpawnObjects in the during an object’s Awake failed to actually enable my scene objects.

I was able to get my scene up and running by pressing “Client Ready” in the network manager HUD, then calling NetworkServer.SpawnObjects in an overridden NetworkManager.OnServerReady.

I would like to just automatically set the ready state without any user interaction. I could implement some timer to do this but that seems like a hacky solution.

Is there a reliable callback that I can use to set ClientScene.Ready after a scene change? This isn’t working in Awake calls and none of my objects are getting to Start until I set the client to ready through the HUD. According to the docs, ClientScene.Ready should be called after all assets are loaded. I figured NetworkManager.OnClientSceneChanged would be a good place for this, but my override for it is never getting called under any circumstance.

Thanks for any help!

Does anyone have any idea as to why my overridden OnClientSceneChanged on my network manager wouldn’t be getting called after successfully changing scenes with ServerChangeScene? OnServerSceneChanged is also not getting called which is probably related.

The rest of my NetworkManager methods seem to be working fine. I used custom logic for OnClientConnect without calling the base method. Perhaps I missed some logic to register for those callbacks? It’s hard to know when you don’t have access to the code.

are there any errors in the editor log?
are you on the latest patch release?

I’m getting no errors in the log and I’m seeing nothing that looks suspicious with debug log level in the network manager. I’ve tried the latest patch release and recently tried the latest beta release to no avail.

OnClientSceneChanged is called on the client when the scene is finished loading. Do you see “ClientChangeScene newSceneName: xxxx” in the log on the client? That is what triggers the client scene change.

I’m not seeing that in the log. And I’m just testing this with one host, so I’m assuming the log will cover both server and client events.

After I call ServerChangeScene, here’s what happens in the log:

ServerChangeScene Level 1
UnityEngine.Networking.NetworkManager:ServerChangeScene(String)

PlayerNotReady hostId: -1 connectionId: -1 isReady: True channel count: 0
UnityEngine.Networking.NetworkManager:ServerChangeScene(String)

Server.SendToAll msgType:39
UnityEngine.Networking.NetworkManager:ServerChangeScene(String)

NetworkManager:OnClientNotReadyMessageInternal
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

NetworkManager:OnClientSceneInternal
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

This is followed by calls to NetworkIdentity::OnDestroy(), NetworkIdentity::OnValidate(), then setting sync vars. Afterward, nothing will happen until I press the “Client Ready” button.