From 6df57cd3cd73149cdd1a52bfb4015e3b75441826 Mon Sep 17 00:00:00 2001 From: hevinci Date: Thu, 8 Sep 2022 15:55:35 +0800 Subject: [PATCH] Update YooAssetSetting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加文件过滤配置 --- .../Editor/AssetBundleBuilder/BuildParameters.cs | 2 -- .../AssetBundleCollector/AssetBundleCollector.cs | 13 +++++++++++-- .../YooAsset/Runtime/Settings/YooAssetSettings.cs | 5 +++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs index 943f5d6..bcaa536 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs @@ -118,6 +118,4 @@ namespace YooAsset.Editor return StringUtility.StringToStringList(BuildinTags, ';'); } } - - } \ No newline at end of file diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs index df40e99..d4c332e 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs @@ -208,12 +208,21 @@ namespace YooAsset.Editor } */ - string ext = System.IO.Path.GetExtension(assetPath); - if (ext == "" || ext == ".dll" || ext == ".cs" || ext == ".js" || ext == ".boo" || ext == ".meta" || ext == ".cginc") + string fileExtension = System.IO.Path.GetExtension(assetPath); + if (IsIgnoreFile(fileExtension)) return false; return true; } + private bool IsIgnoreFile(string fileExtension) + { + foreach (var extension in YooAssetSettings.IgnoreFileExtensions) + { + if (extension == fileExtension) + return true; + } + return false; + } private bool IsCollectAsset(string assetPath) { Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath); diff --git a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs index a63bc3d..8a801c9 100644 --- a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs +++ b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs @@ -45,5 +45,10 @@ namespace YooAsset /// Unity着色器资源包名称 /// public const string UnityShadersBundleName = "unityshaders"; + + /// + /// 忽略的文件类型 + /// + public static readonly string[] IgnoreFileExtensions = { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc" }; } } \ No newline at end of file