@@ -18,12 +18,12 @@ public async Task ExecuteAsync()
1818
1919 //Start Loads
2020 var loadOperation = SceneManager . LoadSceneAsync ( SceneName , Mode ) ;
21-
21+
2222 if ( loadOperation == null )
2323 {
2424 return ;
2525 }
26-
26+
2727 //Allow them all to load till 90% complete
2828 loadOperation . allowSceneActivation = false ;
2929
@@ -34,13 +34,13 @@ public async Task ExecuteAsync()
3434 }
3535
3636 loadOperation . allowSceneActivation = true ;
37-
37+
3838 while ( ! loadOperation . isDone )
3939 {
4040 Progress = loadOperation . progress ;
4141 await Task . Yield ( ) ;
4242 }
43-
43+
4444 ListPool < AsyncOperation > . Release ( loadTasks ) ;
4545
4646 //Load should now be complete
@@ -50,7 +50,7 @@ public async Task ExecuteAsync()
5050 await Task . Yield ( ) ;
5151 }
5252 }
53-
53+
5454 public class MultiSceneTransitionTask : ITransitionTask
5555 {
5656 public string [ ] UnloadScenes { get ; set ; }
@@ -62,11 +62,11 @@ public async Task ExecuteAsync()
6262 {
6363 var unloadTasks = ListPool < AsyncOperation > . Get ( ) ;
6464 var loadTasks = ListPool < AsyncOperation > . Get ( ) ;
65-
65+
6666 Progress = 0 ;
67-
67+
6868 int totalScenes = UnloadScenes . Length + LoadScenes . Length ;
69-
69+
7070 //Start Unloads
7171 for ( var index = 0 ; index < UnloadScenes . Length ; index ++ )
7272 {
@@ -100,13 +100,15 @@ public async Task ExecuteAsync()
100100 }
101101
102102 var waiting = false ;
103-
103+
104104 do
105105 {
106106 await Task . Yield ( ) ;
107107
108108 float sumProgress = 0 ;
109109
110+ waiting = false ;
111+
110112 for ( var index = 0 ; index < unloadTasks . Count ; index ++ )
111113 {
112114 var unload = unloadTasks [ index ] ;
@@ -147,9 +149,9 @@ public async Task ExecuteAsync()
147149
148150 //Load should now be complete
149151 Progress = 1f ;
150-
152+
151153 //Yielding one last time to let the 100% progress to be handled by presenter
152154 await Task . Yield ( ) ;
153155 }
154156 }
155- }
157+ }
0 commit comments