File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public sealed class SimulationModule : EditorModule
2020 private bool _updateOrFixedUpdateWasCalled ;
2121 private long _breakpointHangFlag ;
2222 private EditorWindow _enterPlayFocusedWindow ;
23- private Scene [ ] _scenesToReload ;
23+ private Guid [ ] _scenesToReload ;
2424
2525 internal SimulationModule ( Editor editor )
2626 : base ( editor )
@@ -138,8 +138,15 @@ public void RequestStartPlayGame()
138138 Editor . Simulation . RequestStartPlayScenes ( ) ;
139139 return ;
140140 }
141+ if ( ! FlaxEngine . Content . GetAssetInfo ( firstScene . ID , out var info ) )
142+ {
143+ Editor . LogWarning ( "Invalid First Scene in Game Settings." ) ;
144+ }
141145
142- _scenesToReload = Level . Scenes ;
146+ // Load scenes after entering the play mode
147+ _scenesToReload = new Guid [ Level . ScenesCount ] ;
148+ for ( int i = 0 ; i < _scenesToReload . Length ; i ++ )
149+ _scenesToReload [ i ] = Level . GetScene ( i ) . ID ;
143150 Level . UnloadAllScenes ( ) ;
144151 Level . LoadScene ( firstScene ) ;
145152
@@ -153,8 +160,8 @@ private void OnPlayGameEnd()
153160
154161 Level . UnloadAllScenes ( ) ;
155162
156- foreach ( var scene in _scenesToReload )
157- Level . LoadScene ( scene . ID ) ;
163+ foreach ( var sceneId in _scenesToReload )
164+ Level . LoadScene ( sceneId ) ;
158165 }
159166
160167 /// <summary>
You can’t perform that action at this time.
0 commit comments