MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / OpenScene

Method OpenScene

Source/Editor/Modules/SceneModule.cs:248–271  ·  view source on GitHub ↗

Opens scene (async). Scene ID True if don't close opened scenes and just add new scene to them, otherwise will release current scenes and load single one.

(Guid sceneId, bool additive = false)

Source from the content-addressed store, hash-verified

246 /// <param name="sceneId">Scene ID</param>
247 /// <param name="additive">True if don't close opened scenes and just add new scene to them, otherwise will release current scenes and load single one.</param>
248 public void OpenScene(Guid sceneId, bool additive = false)
249 {
250 if (!Editor.StateMachine.CurrentState.CanChangeScene)
251 return;
252
253 // In play-mode Editor mocks the level streaming script
254 if (Editor.IsPlayMode)
255 {
256 if (!additive)
257 Level.UnloadAllScenesAsync();
258 Level.LoadSceneAsync(sceneId);
259 return;
260 }
261
262 if (!additive)
263 {
264 // Ensure to save all pending changes
265 if (CheckSaveBeforeClose())
266 return;
267 }
268
269 // Load scene
270 Editor.StateMachine.ChangingScenesState.LoadScene(sceneId, additive);
271 }
272
273 /// <summary>
274 /// Reload all loaded scenes.

Callers 6

EndInitMethod · 0.80
OpenMethod · 0.80
OnDragDropMethod · 0.80
CreateContextMenuMethod · 0.80
SpawnMethod · 0.80

Calls 3

UnloadAllScenesAsyncMethod · 0.80
LoadSceneAsyncMethod · 0.45
LoadSceneMethod · 0.45

Tested by

no test coverage detected