diff --git a/Assets/Mirror/Core/NetworkManager.cs b/Assets/Mirror/Core/NetworkManager.cs index ef39cf738..b3b1eda5b 100644 --- a/Assets/Mirror/Core/NetworkManager.cs +++ b/Assets/Mirror/Core/NetworkManager.cs @@ -1283,11 +1283,18 @@ void OnClientDisconnectInternal() // shutdown client NetworkClient.Shutdown(); - foreach (NetworkIdentity identity in NetworkServer.spawned.Values) - identity.clientStarted = false; + // If we're in ServerOnly mode now, StopClient was called for host client. + // We need to reset clientStarted to false so that when we return to + // Host mode, we properly respawn objects from StartClient again. + if (mode == NetworkManagerMode.ServerOnly) + { + foreach (NetworkIdentity identity in NetworkServer.spawned.Values) + identity.clientStarted = false; - // Exit here if we're now in ServerOnly mode (StopClient called in Host mode). - if (mode == NetworkManagerMode.ServerOnly) return; + // Exit here if we're now in ServerOnly mode (StopClient called in Host mode). + // This allows the server to keep running without the host client, keeping remote clients connected. + return; + } // Get Network Manager out of DDOL before going to offline scene // to avoid collision and let a fresh Network Manager be created.