usingSystem.Collections;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Xml;usingUnityEditor;usingUnityEditor.SceneManagement;usingUnityEngine;//
///保存所有的游戏场景,每个场景的数据都会保存到XML,网上都有,只是方便自己用.///
public classExportSceneInfoToXML : Editor {
[MenuItem("GameObject/ExportXML")]static voidExportXML()
{string filepath = Application.dataPath + @"/StreamingAssets/my.xml";if (!File.Exists(filepath))
{
File.Delete(filepath);
}
XmlDocument xmlDoc= newXmlDocument();
XmlElement root= xmlDoc.CreateElement("gameObjects");//遍历所有的游戏场景
foreach (UnityEditor.EditorBuildSettingsScene S inUnityEditor.EditorBuildSettings.scenes)
{//当场景启用
if(S.enabled)
{//得到场景的名称
string name =S.path;//打开这个场景
EditorApplication.OpenScene(name);
XmlElement scenes= xmlDoc.CreateE