public static void BakeMultipleScenes(string[] paths)
{
if (paths.Length != 0)
{
for (int i = 0; i < paths.Length; i++)
{
for (int j = i + 1; j < paths.Length; j++)
{
if (paths[i] == paths[j])
{
throw new Exception("no duplication of scenes is allowed");
}
}
}
if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
SceneSetup[] sceneManagerSetup = EditorSceneManager.GetSceneManagerSetup();
EditorSceneManager.OpenScene(paths[0]);
for (int k = 1; k < paths.Length; k++)
{
EditorSceneManager.OpenScene(paths[k], OpenSceneMode.Additive);
}
Bake();
EditorSceneManager.SaveOpenScenes();
EditorSceneManager.RestoreSceneManagerSetup(sceneManagerSetup);
}
}
}