fix: StopHost with offline scene calls scene change twice (#1409)

* Separate StopHostClient

* Added comments

* move comment

* add comment

* Changed to loadingSceneAsync check

* Update Assets/Mirror/Runtime/NetworkManager.cs

Co-authored-by: vis2k <info@noobtuts.com>
This commit is contained in:
MrGadget 2020-01-11 18:12:46 -05:00 committed by vis2k
parent 29c96b6bc0
commit a0c96f8518

View File

@ -613,7 +613,9 @@ public void StopClient()
// doesn't think we need initialize anything.
mode = NetworkManagerMode.Offline;
if (!string.IsNullOrEmpty(offlineScene) && SceneManager.GetActiveScene().name != offlineScene)
// 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) && SceneManager.GetActiveScene().name != offlineScene && loadingSceneAsync == null)
{
ClientChangeScene(offlineScene, SceneOperation.Normal);
}