Skip to content

Commit 5377775

Browse files
committed
fix problem with scene switching.
get scene by name looks through scenes loaded or scenes being loaded, therefor the scene will be fetched after loading is initiated.
1 parent 79038d8 commit 5377775

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

MLAPI/NetworkingManagerComponents/Core/NetworkSceneManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ public static void SwitchScene(string sceneName)
5656
CurrentSceneIndex = sceneNameToIndex[sceneName];
5757
isSwitching = true;
5858
lastScene = SceneManager.GetActiveScene();
59+
60+
AsyncOperation sceneLoad = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
5961
nextScene = SceneManager.GetSceneByName(sceneName);
60-
AsyncOperation sceneLoad = SceneManager.LoadSceneAsync(nextScene.buildIndex, LoadSceneMode.Additive);
6162
sceneLoad.completed += OnSceneLoaded;
6263

6364
using (PooledBitStream stream = PooledBitStream.Get())

0 commit comments

Comments
 (0)