Update AssetBundleBuilder

修改内置构建管线的构建结果验证逻辑。
pull/28/head
hevinci 2022-07-19 19:20:05 +08:00
parent c782e8154b
commit 92fad7f29b
2 changed files with 6 additions and 30 deletions

View File

@ -28,7 +28,7 @@ namespace YooAsset.Editor
try try
{ {
var taskAttribute = task.GetType().GetCustomAttribute<TaskAttribute>(); var taskAttribute = task.GetType().GetCustomAttribute<TaskAttribute>();
Log($"---------------------------------------->{taskAttribute.Desc}"); Log($"---------------------------------------->{taskAttribute.Desc}<---------------------------------------");
task.Run(context); task.Run(context);
} }
catch (Exception e) catch (Exception e)

View File

@ -64,38 +64,14 @@ namespace YooAsset.Editor
if (expectBuildinAssetPaths.Length != allBuildinAssetPaths.Length) if (expectBuildinAssetPaths.Length != allBuildinAssetPaths.Length)
{ {
Debug.LogWarning($"构建的Bundle文件内的资源对象数量和预期不匹配 : {buildedBundle}"); Debug.LogWarning($"构建的Bundle文件内的资源对象数量和预期不匹配 : {buildedBundle}");
var intersectAssetList = expectBuildinAssetPaths.Except(allBuildinAssetPaths).ToList();
foreach (var intersectAssset in intersectAssetList)
{
Debug.LogWarning($"构建失败的资源对象路径为 : {intersectAssset}");
}
isPass = false; isPass = false;
continue; continue;
} }
foreach (var buildinAssetPath in allBuildinAssetPaths)
{
var guid = AssetDatabase.AssetPathToGUID(buildinAssetPath);
if (string.IsNullOrEmpty(guid))
{
Debug.LogWarning($"无效的资源路径,请检查路径是否带有特殊符号或中文:{buildinAssetPath}");
isPass = false;
continue;
}
bool isMatch = false;
foreach (var exceptBuildAssetPath in expectBuildinAssetPaths)
{
var guidExcept = AssetDatabase.AssetPathToGUID(exceptBuildAssetPath);
if (guid == guidExcept)
{
isMatch = true;
break;
}
}
if (isMatch == false)
{
Debug.LogWarning($"在构建的Bundle文件里发现了没有匹配的资源对象{buildinAssetPath}");
isPass = false;
continue;
}
}
EditorTools.DisplayProgressBar("验证构建结果", ++progressValue, buildedBundles.Length); EditorTools.DisplayProgressBar("验证构建结果", ++progressValue, buildedBundles.Length);
} }
EditorTools.ClearProgressBar(); EditorTools.ClearProgressBar();