Merge remote-tracking branch 'origin/master' into 1.6

This commit is contained in:
Wojtek Figat
2023-05-05 11:41:32 +02:00
15 changed files with 96 additions and 16 deletions

View File

@@ -656,7 +656,7 @@ namespace FlaxEditor.Modules
var children = folder.Children.ToArray();
for (int i = 0; i < children.Length; i++)
{
Delete(children[0]);
Delete(children[i]);
}
}

View File

@@ -315,6 +315,42 @@ namespace FlaxEditor.Modules
Editor.StateMachine.ChangingScenesState.UnloadScene(Level.Scenes);
}
/// <summary>
/// Closes all of the scenes except for the specified scene (async).
/// </summary>
/// <param name="scene">The scene to not close.</param>
public void CloseAllScenesExcept(Scene scene)
{
// Check if cannot change scene now
if (!Editor.StateMachine.CurrentState.CanChangeScene)
return;
var scenes = new List<Scene>();
foreach (var s in Level.Scenes)
{
if (s == scene)
continue;
scenes.Add(s);
}
// In play-mode Editor mocks the level streaming script
if (Editor.IsPlayMode)
{
foreach (var s in scenes)
{
Level.UnloadSceneAsync(s);
}
return;
}
// Ensure to save all pending changes
if (CheckSaveBeforeClose())
return;
// Unload scenes
Editor.StateMachine.ChangingScenesState.UnloadScene(scenes);
}
/// <summary>
/// Show save before scene load/unload action.
/// </summary>