Skip to content

Commit

Permalink
fix: Re-enable transport if aborting additive load/unload (#1683)
Browse files Browse the repository at this point in the history
* fix: Re-enable transports if aborting additive load/unload

* Restore debug if's
  • Loading branch information
MrGadget committed Apr 10, 2020
1 parent 95705a1 commit bc37497
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Assets/Mirror/Runtime/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -853,16 +853,24 @@ internal void ClientChangeScene(string newSceneName, SceneOperation sceneOperati
if (!SceneManager.GetSceneByName(newSceneName).IsValid())
loadingSceneAsync = SceneManager.LoadSceneAsync(newSceneName, LoadSceneMode.Additive);
else
{
Debug.LogWarningFormat("Scene {0} is already loaded", newSceneName);
Transport.activeTransport.enabled = true;
}
break;
case SceneOperation.UnloadAdditive:
if (SceneManager.GetSceneByName(newSceneName).IsValid())
{
if (SceneManager.GetSceneByName(newSceneName) != null)
loadingSceneAsync = SceneManager.UnloadSceneAsync(newSceneName, UnloadSceneOptions.UnloadAllEmbeddedSceneObjects);
else
Transport.activeTransport.enabled = true;
}
else
{
Debug.LogWarning("Cannot unload the active scene with UnloadAdditive operation");
Transport.activeTransport.enabled = true;
}
break;
}

Expand Down

0 comments on commit bc37497

Please sign in to comment.