From fb608d685a5aeda793d793a10358d7948bcf5aaf Mon Sep 17 00:00:00 2001 From: MrGadget1024 Date: Tue, 6 Jul 2021 12:07:22 -0400 Subject: [PATCH] fix: Fixed additive scenes on host client - This was broken by #a0f5a846 --- Assets/Mirror/Runtime/NetworkManager.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/Mirror/Runtime/NetworkManager.cs b/Assets/Mirror/Runtime/NetworkManager.cs index e05fc800f..325c12390 100644 --- a/Assets/Mirror/Runtime/NetworkManager.cs +++ b/Assets/Mirror/Runtime/NetworkManager.cs @@ -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.