From 911c7102db78fe0ed96d51c1681cfb5d9cad9b4b Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期一, 15 九月 2025 16:36:39 +0800 Subject: [PATCH] 0312 场景转移出来 --- Assets/Editor/Tool/UpdateAssetBundleName.cs | 62 +++++++++++++++++++++++------- 1 files changed, 47 insertions(+), 15 deletions(-) diff --git a/Assets/Editor/Tool/UpdateAssetBundleName.cs b/Assets/Editor/Tool/UpdateAssetBundleName.cs index be27dc5..85776bc 100644 --- a/Assets/Editor/Tool/UpdateAssetBundleName.cs +++ b/Assets/Editor/Tool/UpdateAssetBundleName.cs @@ -311,9 +311,12 @@ 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 string rootPath = Application.dataPath + "/ResourcesOut/Scenes"; + static string assetPath = "Assets/ResourcesOut/Scenes"; static HashSet<string> exportMaps;//鍘婚櫎鐨勫湴鍥惧垪琛� + + static string rootTexturePath = Application.dataPath + "/ResourcesOut/Texture"; + static string assetTexturePath = "Assets/ResourcesOut/Texture"; [MenuItem("绋嬪簭/璁剧疆璧勬簮鍖呭悕/鏇存柊Level(All) AssetBundleName")] @@ -321,19 +324,19 @@ { // 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); - // var name = Path.GetFileNameWithoutExtension(file.FullName); - // if (exportMaps.Contains(name)) //鍒ゆ柇杩欎釜鍦板浘鏄惁琚帓闄わ紝琚帓闄や笉鎵撳寘 - // importer.assetBundleName = ""; - // else - // importer.assetBundleName = "maps/" + name.ToLower(); + 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); + var name = Path.GetFileNameWithoutExtension(file.FullName); + // if (exportMaps.Contains(name)) //鍒ゆ柇杩欎釜鍦板浘鏄惁琚帓闄わ紝琚帓闄や笉鎵撳寘 + // importer.assetBundleName = ""; + // else + importer.assetBundleName = "maps/" + name.ToLower(); - // // EditorUtility.SetDirty(importer); - // } + // EditorUtility.SetDirty(importer); + } // var createRoleAssets = AssetDatabase.FindAssets("t:prefab", new string[] { "Assets/ResourcesOut/Scene/CreateRole" }); // foreach (var item in createRoleAssets) @@ -343,7 +346,7 @@ // // EditorUtility.SetDirty(importer); // } - // var textures = AssetDatabase.FindAssets("t:Texture2D", new string[] { "Assets/ResourcesOut/Scene/Textures" }); + // var textures = AssetDatabase.FindAssets("*.jpg", new string[] { "Assets/ResourcesOut/Texture/FullScreenBg" }); // foreach (var item in textures) // { // var importer = AssetImporter.GetAtPath(AssetDatabase.GUIDToAssetPath(item)); @@ -352,6 +355,35 @@ // } // exportMaps?.Clear(); // exportMaps = null; + + allFiles = new DirectoryInfo(rootTexturePath).GetFiles("*.jpg", SearchOption.TopDirectoryOnly); + foreach (var file in allFiles) + { + var importerPath = assetTexturePath + Path.DirectorySeparatorChar + file.Name; + var importer = AssetImporter.GetAtPath(importerPath); + var name = Path.GetFileNameWithoutExtension(file.FullName); + // if (exportMaps.Contains(name)) //鍒ゆ柇杩欎釜鍦板浘鏄惁琚帓闄わ紝琚帓闄や笉鎵撳寘 + // importer.assetBundleName = ""; + // else + importer.assetBundleName = "maps/" + name.ToLower(); + + // EditorUtility.SetDirty(importer); + } + + allFiles = new DirectoryInfo(rootTexturePath).GetFiles("*.png", SearchOption.TopDirectoryOnly); + foreach (var file in allFiles) + { + var importerPath = assetTexturePath + Path.DirectorySeparatorChar + file.Name; + var importer = AssetImporter.GetAtPath(importerPath); + var name = Path.GetFileNameWithoutExtension(file.FullName); + // if (exportMaps.Contains(name)) //鍒ゆ柇杩欎釜鍦板浘鏄惁琚帓闄わ紝琚帓闄や笉鎵撳寘 + // importer.assetBundleName = ""; + // else + importer.assetBundleName = "maps/" + name.ToLower(); + + // EditorUtility.SetDirty(importer); + } + Debug.Log("map璧勬簮鍖呭悕鏇存柊瀹屾垚!"); // AssetDatabase.SaveAssets(); // AssetDatabase.Refresh(); -- Gitblit v1.8.0