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)
| 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. |
no test coverage detected