using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEditor;
|
|
public class ScenesInBuildSetting
|
{
|
|
[MenuItem("程序/Scenes/Delete All", false, 1)]
|
public static void DeleteSceneInBuild()
|
{
|
AssetDatabase.Refresh();
|
string scenePath = "";
|
ArrayList list = new ArrayList();
|
foreach (EditorBuildSettingsScene e in EditorBuildSettings.scenes)
|
{
|
if (e == null)
|
{
|
continue;
|
}
|
|
scenePath = e.path;
|
EditorBuildSettingsScene scene = new EditorBuildSettingsScene
|
{
|
path = scenePath,
|
enabled = scenePath == "Assets/Resources/Scenes/Launch.unity" || scenePath == "Assets/Resources/Scenes/Empty.unity" ? true : false
|
};
|
list.Add(scene);
|
}
|
EditorBuildSettings.scenes = list.ToArray(typeof(EditorBuildSettingsScene)) as EditorBuildSettingsScene[];
|
}
|
|
[MenuItem("程序/Scenes/Add All", false, 1)]
|
public static void AddSceneInBuild()
|
{
|
AssetDatabase.Refresh();
|
string scenePath = "";
|
bool sceneEnable = false;
|
ArrayList list = new ArrayList();
|
foreach (EditorBuildSettingsScene e in EditorBuildSettings.scenes)
|
{
|
if (e == null)
|
{
|
continue;
|
}
|
|
scenePath = e.path;
|
if (scenePath.ToLower().IndexOf("test") == -1)
|
{
|
sceneEnable = true;
|
}
|
else
|
{
|
sceneEnable = false;
|
}
|
EditorBuildSettingsScene scene = new EditorBuildSettingsScene
|
{
|
path = scenePath,
|
enabled = sceneEnable
|
};
|
list.Add(scene);
|
}
|
EditorBuildSettings.scenes = list.ToArray(typeof(EditorBuildSettingsScene)) as EditorBuildSettingsScene[];
|
}
|
}
|