mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix: NetworkManager - keep in DDOL if ServerOnly
- like when StopClient called for Host
This commit is contained in:
parent
a83379fe17
commit
3d9e95e52c
@ -1206,16 +1206,6 @@ void OnClientDisconnectInternal()
|
||||
authenticator.OnStopClient();
|
||||
}
|
||||
|
||||
// Get Network Manager out of DDOL before going to offline scene
|
||||
// to avoid collision and let a fresh Network Manager be created.
|
||||
// IMPORTANT: .gameObject can be null if StopClient is called from
|
||||
// OnApplicationQuit or from tests!
|
||||
if (gameObject != null
|
||||
&& gameObject.scene.name == "DontDestroyOnLoad"
|
||||
&& !string.IsNullOrWhiteSpace(offlineScene)
|
||||
&& SceneManager.GetActiveScene().path != offlineScene)
|
||||
SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetActiveScene());
|
||||
|
||||
// set mode BEFORE changing scene so FinishStartScene doesn't re-initialize anything.
|
||||
// set mode BEFORE NetworkClient.Disconnect so StopClient only runs once.
|
||||
// set mode BEFORE OnStopClient so StopClient only runs once.
|
||||
@ -1235,6 +1225,16 @@ void OnClientDisconnectInternal()
|
||||
// Exit here if we're now in ServerOnly mode (StopClient called in Host mode).
|
||||
if (mode == NetworkManagerMode.ServerOnly) return;
|
||||
|
||||
// Get Network Manager out of DDOL before going to offline scene
|
||||
// to avoid collision and let a fresh Network Manager be created.
|
||||
// IMPORTANT: .gameObject can be null if StopClient is called from
|
||||
// OnApplicationQuit or from tests!
|
||||
if (gameObject != null
|
||||
&& gameObject.scene.name == "DontDestroyOnLoad"
|
||||
&& !string.IsNullOrWhiteSpace(offlineScene)
|
||||
&& SceneManager.GetActiveScene().path != offlineScene)
|
||||
SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetActiveScene());
|
||||
|
||||
// If StopHost called in Host mode, StopServer will change scenes after this.
|
||||
// Check loadingSceneAsync to ensure we don't double-invoke the scene change.
|
||||
// Check if NetworkServer.active because we can get here via Disconnect before server has started to change scenes.
|
||||
|
Loading…
Reference in New Issue
Block a user