From 62b1293121c2efe499b4f07091fcee659e3e5e94 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 28 十一月 2025 16:35:18 +0800
Subject: [PATCH] 0312 增加音效打包空文件输出

---
 Assets/Editor/Tool/UpdateAssetBundleName.cs |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Assets/Editor/Tool/UpdateAssetBundleName.cs b/Assets/Editor/Tool/UpdateAssetBundleName.cs
index c2e690e..e4f05ac 100644
--- a/Assets/Editor/Tool/UpdateAssetBundleName.cs
+++ b/Assets/Editor/Tool/UpdateAssetBundleName.cs
@@ -435,6 +435,11 @@
             var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar);
             var importerPath = assetPath + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name;
             var importer = AssetImporter.GetAtPath(importerPath);
+            if (importer == null)
+            {
+                Debug.LogError("SetAllAudioAssetBundleName is null" + importerPath);
+                continue;
+            }
             importer.assetBundleName = "audio/" + pathStringArray[pathStringArray.Length - 1].ToLower();
             // EditorUtility.SetDirty(importer);
         }
@@ -444,6 +449,11 @@
             var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar);
             var importerPath = assetPath + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name;
             var importer = AssetImporter.GetAtPath(importerPath);
+            if (importer == null)
+            {
+                Debug.LogError("SetAllAudioAssetBundleName is null" + importerPath);
+                continue;
+            }
             importer.assetBundleName = "audio/" + pathStringArray[pathStringArray.Length - 1].ToLower();
             // EditorUtility.SetDirty(importer);
         }

--
Gitblit v1.8.0