diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs
index bd2d0ed..4e7d568 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs
@@ -132,10 +132,10 @@ namespace YooAsset.Editor
///
/// 获取打包收集的资源文件
///
- public List GetAllCollectAssets(EBuildMode buildMode, bool enableAddressable, AssetBundleCollectorGroup group)
+ public List GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
{
// 注意:模拟构建模式下只收集主资源
- if (buildMode == EBuildMode.SimulateBuild)
+ if (command.BuildMode == EBuildMode.SimulateBuild)
{
if (CollectorType != ECollectorType.MainAssetCollector)
return new List();
@@ -162,7 +162,7 @@ namespace YooAsset.Editor
{
if (result.ContainsKey(assetPath) == false)
{
- var collectAssetInfo = CreateCollectAssetInfo(buildMode, group, assetPath, isRawAsset);
+ var collectAssetInfo = CreateCollectAssetInfo(command, group, assetPath, isRawAsset);
result.Add(assetPath, collectAssetInfo);
}
else
@@ -177,7 +177,7 @@ namespace YooAsset.Editor
string assetPath = CollectPath;
if (IsValidateAsset(assetPath) && IsCollectAsset(assetPath))
{
- var collectAssetInfo = CreateCollectAssetInfo(buildMode, group, assetPath, isRawAsset);
+ var collectAssetInfo = CreateCollectAssetInfo(command, group, assetPath, isRawAsset);
result.Add(assetPath, collectAssetInfo);
}
else
@@ -187,7 +187,7 @@ namespace YooAsset.Editor
}
// 检测可寻址地址是否重复
- if (enableAddressable)
+ if (command.EnableAddressable)
{
HashSet adressTemper = new HashSet();
foreach (var collectInfoPair in result)
@@ -207,7 +207,7 @@ namespace YooAsset.Editor
return result.Values.ToList();
}
- private CollectAssetInfo CreateCollectAssetInfo(EBuildMode buildMode, AssetBundleCollectorGroup group, string assetPath, bool isRawAsset)
+ private CollectAssetInfo CreateCollectAssetInfo(CollectCommand command, AssetBundleCollectorGroup group, string assetPath, bool isRawAsset)
{
string address = GetAddress(group, assetPath);
string bundleName = GetBundleName(group, assetPath);
@@ -215,7 +215,7 @@ namespace YooAsset.Editor
CollectAssetInfo collectAssetInfo = new CollectAssetInfo(CollectorType, bundleName, address, assetPath, assetTags, isRawAsset);
// 注意:模拟构建模式下不需要收集依赖资源
- if (buildMode == EBuildMode.SimulateBuild)
+ if (command.BuildMode == EBuildMode.SimulateBuild)
collectAssetInfo.DependAssets = new List();
else
collectAssetInfo.DependAssets = GetAllDependencies(assetPath);
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs
index 334a18b..0575619 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs
@@ -69,7 +69,7 @@ namespace YooAsset.Editor
///
/// 获取打包收集的资源文件
///
- public List GetAllCollectAssets(EBuildMode buildMode, bool enableAddressable)
+ public List GetAllCollectAssets(CollectCommand command)
{
Dictionary result = new Dictionary(10000);
@@ -83,7 +83,7 @@ namespace YooAsset.Editor
// 收集打包资源
foreach (var collector in Collectors)
{
- var temper = collector.GetAllCollectAssets(buildMode, enableAddressable, this);
+ var temper = collector.GetAllCollectAssets(command, this);
foreach (var assetInfo in temper)
{
if (result.ContainsKey(assetInfo.AssetPath) == false)
@@ -94,7 +94,7 @@ namespace YooAsset.Editor
}
// 检测可寻址地址是否重复
- if (enableAddressable)
+ if (command.EnableAddressable)
{
HashSet adressTemper = new HashSet();
foreach (var collectInfoPair in result)
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs
index 453274d..7815973 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs
@@ -56,14 +56,14 @@ namespace YooAsset.Editor
///
/// 获取打包收集的资源文件
///
- public List GetAllCollectAssets(EBuildMode buildMode, bool enableAddressable)
+ public List GetAllCollectAssets(CollectCommand command)
{
Dictionary result = new Dictionary(10000);
// 收集打包资源
foreach (var group in Groups)
{
- var temper = group.GetAllCollectAssets(buildMode, enableAddressable);
+ var temper = group.GetAllCollectAssets(command);
foreach (var assetInfo in temper)
{
if (result.ContainsKey(assetInfo.AssetPath) == false)
@@ -74,7 +74,7 @@ namespace YooAsset.Editor
}
// 检测可寻址地址是否重复
- if (enableAddressable)
+ if (command.EnableAddressable)
{
HashSet adressTemper = new HashSet();
foreach (var collectInfoPair in result)
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs
index b6cd158..9f4223c 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs
@@ -9,7 +9,7 @@ namespace YooAsset.Editor
public class AssetBundleCollectorSetting : ScriptableObject
{
///
- /// 是否显示包裹视图
+ /// 是否显示包裹列表视图
///
public bool ShowPackageView = false;
@@ -18,6 +18,11 @@ namespace YooAsset.Editor
///
public bool EnableAddressable = false;
+ ///
+ /// 资源包名唯一化
+ ///
+ public bool UniqueBundleName = false;
+
///
/// 包裹列表
///
@@ -76,37 +81,43 @@ namespace YooAsset.Editor
Debug.LogWarning($"Not found package : {packageName}");
return new List();
}
-
+
///
/// 获取包裹收集的资源文件
///
- public List GetPackageAssets(EBuildMode buildMode, string packageName)
+ public CollectResult GetPackageAssets(EBuildMode buildMode, string packageName)
{
if (string.IsNullOrEmpty(packageName))
- throw new Exception("Build Package name is null or mepty !");
+ throw new Exception("Build package name is null or mepty !");
foreach (var package in Packages)
{
if (package.PackageName == packageName)
{
- return package.GetAllCollectAssets(buildMode, EnableAddressable);
+ CollectCommand command = new CollectCommand(buildMode, EnableAddressable);
+ CollectResult collectResult = new CollectResult(package.PackageName, EnableAddressable, UniqueBundleName);
+ collectResult.SetCollectAssets(package.GetAllCollectAssets(command));
+ return collectResult;
}
}
+
throw new Exception($"Not found collector pacakge : {packageName}");
}
///
/// 获取所有包裹收集的资源文件
///
- public List GetAllPackageAssets(EBuildMode buildMode)
+ public List GetAllPackageAssets(EBuildMode buildMode)
{
- List result = new List(1000);
+ List collectResultList = new List(1000);
foreach (var package in Packages)
{
- var temper = package.GetAllCollectAssets(buildMode, EnableAddressable);
- result.AddRange(temper);
+ CollectCommand command = new CollectCommand(buildMode, EnableAddressable);
+ CollectResult collectResult = new CollectResult(package.PackageName, EnableAddressable, UniqueBundleName);
+ collectResult.SetCollectAssets(package.GetAllCollectAssets(command));
+ collectResultList.Add(collectResult);
}
- return result;
+ return collectResultList;
}
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
index 53d46c1..1a1383e 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs
@@ -347,6 +347,11 @@ namespace YooAsset.Editor
Setting.EnableAddressable = enableAddressable;
IsDirty = true;
}
+ public static void ModifyUniqueBundleName(bool uniqueBundleName)
+ {
+ Setting.UniqueBundleName = uniqueBundleName;
+ IsDirty = true;
+ }
// 资源包裹编辑相关
public static void CreatePackage(string packageName)
diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
index 9447ae4..4fe71d9 100644
--- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
+++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs
@@ -27,6 +27,7 @@ namespace YooAsset.Editor
private Toggle _showPackageToogle;
private Toggle _enableAddressableToogle;
+ private Toggle _uniqueBundleNameToogle;
private VisualElement _packageContainer;
private ListView _packageListView;
@@ -87,6 +88,12 @@ namespace YooAsset.Editor
AssetBundleCollectorSettingData.ModifyAddressable(evt.newValue);
RefreshWindow();
});
+ _uniqueBundleNameToogle = root.Q("UniqueBundleName");
+ _uniqueBundleNameToogle.RegisterValueChangedCallback(evt =>
+ {
+ AssetBundleCollectorSettingData.ModifyUniqueBundleName(evt.newValue);
+ RefreshWindow();
+ });
// 配置修复按钮
var fixBtn = root.Q