@@ -47,15 +47,8 @@ public static void SwitchScene(string sceneName)
4747 isSwitching = true ;
4848 lastScene = SceneManager . GetActiveScene ( ) ;
4949 AsyncOperation sceneLoad = SceneManager . LoadSceneAsync ( sceneName , LoadSceneMode . Additive ) ;
50- #if ! UNITY_5
5150 sceneLoad . completed += OnSceneLoaded ;
52- #else
53- NetworkingManager . singleton . StartCoroutine ( NetworkingManager . singleton . WaitForSceneSwitch ( sceneLoad , ( ) =>
54- {
55- //This block runs when scene switch is done.
56- OnSceneLoaded ( sceneLoad ) ;
57- } ) ) ;
58- #endif
51+
5952 using ( MemoryStream stream = new MemoryStream ( 4 ) )
6053 {
6154 using ( BinaryWriter writer = new BinaryWriter ( stream ) )
@@ -80,15 +73,7 @@ internal static void OnSceneSwitch(uint sceneIndex)
8073 }
8174 lastScene = SceneManager . GetActiveScene ( ) ;
8275 AsyncOperation sceneLoad = SceneManager . LoadSceneAsync ( sceneIndexToString [ sceneIndex ] , LoadSceneMode . Additive ) ;
83- #if ! UNITY_5
8476 sceneLoad . completed += OnSceneLoaded ;
85- #else
86- NetworkingManager . singleton . StartCoroutine ( NetworkingManager . singleton . WaitForSceneSwitch ( sceneLoad , ( ) =>
87- {
88- //This block runs when scene switch is done.
89- OnSceneLoaded ( sceneLoad ) ;
90- } ) ) ;
91- #endif
9277 }
9378
9479 private static void OnSceneLoaded ( AsyncOperation operation )
@@ -101,15 +86,7 @@ private static void OnSceneLoaded(AsyncOperation operation)
10186 SceneManager . MoveGameObjectToScene ( objectsToKeep [ i ] . gameObject , nextScene ) ;
10287 }
10388 AsyncOperation sceneLoad = SceneManager . UnloadSceneAsync ( lastScene ) ;
104- #if ! UNITY_5
10589 sceneLoad . completed += OnSceneUnload ;
106- #else
107- NetworkingManager . singleton . StartCoroutine ( NetworkingManager . singleton . WaitForSceneSwitch ( sceneLoad , ( ) =>
108- {
109- //This block runs when scene switch is done.
110- OnSceneUnload ( sceneLoad ) ;
111- } ) ) ;
112- #endif
11390 }
11491
11592 private static void OnSceneUnload ( AsyncOperation operation )
0 commit comments