Skip to content

Commit

Permalink
fix: Prevent host client redundantly changing to offline scene
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Langsenkamp committed May 9, 2020
1 parent e00186e commit b4511a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Assets/Mirror/Runtime/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@ public void StopClient()

// If this is the host player, StopServer will already be changing scenes.
// Check loadingSceneAsync to ensure we don't double-invoke the scene change.
if (!string.IsNullOrEmpty(offlineScene) && !IsSceneActive(offlineScene) && loadingSceneAsync == null)
// Check if NetworkServer.active because we can get here via Disconnect before server has started to change scenes.
if (!string.IsNullOrEmpty(offlineScene) && !IsSceneActive(offlineScene) && loadingSceneAsync == null && !NetworkServer.active)
{
ClientChangeScene(offlineScene, SceneOperation.Normal);
}
Expand Down

0 comments on commit b4511a0

Please sign in to comment.