public static void ExportAllSelectedScene() { Scene currentScene = EditorSceneManager.GetSceneAt(0); var selection = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets); var paths = (from s in selection let path = AssetDatabase.GetAssetPath(s) where File.Exists(path) && path.EndsWith(".unity") select path).ToArray(); int num = 0; foreach (string item in paths) { EditorUtility.DisplayCancelableProgressBar("导出中", "这会要一些时间,请耐心等待 " + num + "/" + paths.Length, (float)num / (float)paths.Length); if (!EditorSceneManager.GetSceneByPath(item).isLoaded) { currentScene = EditorSceneManager.OpenScene(item); #if OBJECT ScenesFixer.FixFolderPosition(); #endif } WriteXml(); num++; Debug.Log("导出场景为" + item); EditorSceneManager.CloseScene(currentScene, true); } EditorUtility.ClearProgressBar(); }
public static void ExportScene() { //加载路径 //LoadPathFile(); #if OBJECT ScenesFixer.FixFolderPosition(); #endif WriteXml(); AssetDatabase.Refresh(); }