From 92334ba2aa148fa1a12ee15ea5cb985831291aee Mon Sep 17 00:00:00 2001 From: MrGadget <9826063+MrGadget1024@users.noreply.github.com> Date: Tue, 22 Jun 2021 01:29:49 -0400 Subject: [PATCH] fix: Don't call FinishLoadScene when customHandling (#2794) * fix: Don't call FinishLoadScene when customHandling FinishLoadScene will be called from `UpdateScene` if `loadingSceneAsync != null && loadingSceneAsync.isDone` and it's the responsibility of the user in their custom handler to assign `loadingSceneAsync` to something to block FinishLoadScene until that completes. * Update Assets/Mirror/Runtime/NetworkManager.cs Co-authored-by: vis2k --- Assets/Mirror/Runtime/NetworkManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Mirror/Runtime/NetworkManager.cs b/Assets/Mirror/Runtime/NetworkManager.cs index ca21a9e10..3d58cd186 100644 --- a/Assets/Mirror/Runtime/NetworkManager.cs +++ b/Assets/Mirror/Runtime/NetworkManager.cs @@ -800,11 +800,11 @@ internal void ClientChangeScene(string newSceneName, SceneOperation sceneOperati OnClientChangeScene(newSceneName, sceneOperation, customHandling); // 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. + // (in other words, custom loading needs to call FinishLoadScene when they are done) if (customHandling) - { - FinishLoadScene(); return; - } switch (sceneOperation) {