Cute_demon_attacks/meng_yao/Assets/Plugins/SceneEditor.cs
2024-12-09 11:56:41 +08:00

25 lines
643 B
C#

using UnityEditor;
using UnityEditor.SceneManagement;
class SceneEditor
{
[MenuItem("Tools/Bake Scenes In Build")]
private static void Bake()
{
var activeScene = EditorSceneManager.GetActiveScene().path;
foreach (var scene in EditorBuildSettings.scenes)
{
if (!scene.enabled)
continue;
EditorSceneManager.OpenScene(scene.path, OpenSceneMode.Single);
Lightmapping.Bake();
EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
}
if (activeScene != "")
EditorSceneManager.OpenScene(activeScene);
}
}