fix: Fixed additive scenes on host client

- This was broken by #a0f5a846
This commit is contained in:
MrGadget1024 2021-07-06 12:07:22 -04:00
parent c0a5dff95f
commit fb608d685a

View File

@ -786,6 +786,14 @@ internal void ClientChangeScene(string newSceneName, SceneOperation sceneOperati
// Debug.Log("ClientChangeScene newSceneName:" + newSceneName + " networkSceneName:" + networkSceneName);
// Let client prepare for scene change
OnClientChangeScene(newSceneName, sceneOperation, customHandling);
// After calling OnClientChangeScene, exit if server since server is already doing
// the actual scene change, and we don't need to do it for the host client
if (NetworkServer.active)
return;
// set client flag to stop processing messages while loading scenes.
// otherwise we would process messages and then lose all the state
// as soon as the load is finishing, causing all kinds of bugs
@ -798,14 +806,6 @@ internal void ClientChangeScene(string newSceneName, SceneOperation sceneOperati
// Scene message in OnClientChangeScene and OnClientSceneChanged
clientSceneOperation = sceneOperation;
// Let client prepare for scene change
OnClientChangeScene(newSceneName, sceneOperation, customHandling);
// After calling OnClientChangeScene, exit if server since server is already doing
// the actual scene change, and we don't need to do it for the host client
if (NetworkServer.active)
return;
// scene handling will happen in overrides of OnClientChangeScene and/or OnClientSceneChanged
// Do not call FinishLoadScene here. Custom handler will assign loadingSceneAsync and we need
// to wait for that to finish. UpdateScene already checks for that to be not null and isDone.