From d53163a421aa411a3587d4e1f3496e12d19e5e16 Mon Sep 17 00:00:00 2001 From: lwb <q3213421wrwqr> Date: 星期六, 16 一月 2021 16:32:28 +0800 Subject: [PATCH] 9527 地图资源打包排除配置 --- Assets/Editor/Tool/UpdateAssetBundleName.cs | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-) diff --git a/Assets/Editor/Tool/UpdateAssetBundleName.cs b/Assets/Editor/Tool/UpdateAssetBundleName.cs index fbab537..25c3cf6 100644 --- a/Assets/Editor/Tool/UpdateAssetBundleName.cs +++ b/Assets/Editor/Tool/UpdateAssetBundleName.cs @@ -373,8 +373,10 @@ public class UpdateLevelSetting { + static string exportMapsPath = Application.dataPath + "/Editor/Config/ExportMaps.txt"; static string rootPath = Application.dataPath + "/Art/Maps/Scenes"; static string assetPath = "Assets/Art/Maps/Scenes"; + static HashSet<string> exportMaps;//鍘婚櫎鐨勫湴鍥惧垪琛� public static void SetCreateRoleLevel(string pattern) { @@ -395,12 +397,19 @@ [MenuItem("绋嬪簭/璁剧疆璧勬簮鍖呭悕/鏇存柊Level(All) AssetBundleName")] public static void SetAllLevelAssetBundleName() { + ReadExportConfig(); + var allFiles = new DirectoryInfo(rootPath).GetFiles("*.unity", SearchOption.TopDirectoryOnly); foreach (var file in allFiles) { var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name; var importer = AssetImporter.GetAtPath(importerPath); - importer.assetBundleName = "maps/" + Path.GetFileNameWithoutExtension(file.FullName).ToLower(); + var name = Path.GetFileNameWithoutExtension(file.FullName); + if (exportMaps.Contains(name)) //鍒ゆ柇杩欎釜鍦板浘鏄惁琚帓闄わ紝琚帓闄や笉鎵撳寘 + importer.assetBundleName = ""; + else + importer.assetBundleName = "maps/" + name.ToLower(); + // EditorUtility.SetDirty(importer); } @@ -419,11 +428,23 @@ importer.assetBundleName = "maps/textures"; // EditorUtility.SetDirty(importer); } + exportMaps?.Clear(); + exportMaps = null; DebugEx.Log("Level璧勬簮鍖呭悕鏇存柊瀹屾垚!"); // AssetDatabase.SaveAssets(); // AssetDatabase.Refresh(); } + //璇诲彇鎺掗櫎鍦板浘鐨勯厤缃� + private static void ReadExportConfig() + { + if (File.Exists(exportMapsPath)) + { + var lines = File.ReadAllLines(exportMapsPath); + exportMaps = new HashSet<string>(lines); + } + } + } public class UpdateAudioSetting -- Gitblit v1.8.0