From d6e3da322bc9a720956051fd0f7d564e118a4996 Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 5 Aug 2022 14:40:27 +0800 Subject: [PATCH] Update AssetBundleBuilder --- .../BuildTasks/TaskPrepare.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs index 73e5b85..034cf5b 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs @@ -14,6 +14,8 @@ namespace YooAsset.Editor var buildParameters = context.GetContextObject(); buildParameters.BeginWatch(); + var buildMode = buildParameters.Parameters.BuildMode; + // 检测构建平台是否合法 if (buildParameters.Parameters.BuildTarget == BuildTarget.NoTarget) throw new Exception("请选择目标平台"); @@ -26,19 +28,21 @@ namespace YooAsset.Editor if (string.IsNullOrEmpty(buildParameters.PipelineOutputDirectory)) throw new Exception("输出目录不能为空"); - // 检测当前是否正在构建资源包 - if (BuildPipeline.isBuildingPlayer) - throw new Exception("当前正在构建资源包,请结束后再试"); + if (buildMode != EBuildMode.SimulateBuild) + { + // 检测当前是否正在构建资源包 + if (BuildPipeline.isBuildingPlayer) + throw new Exception("当前正在构建资源包,请结束后再试"); - // 检测是否有未保存场景 - if (EditorTools.HasDirtyScenes()) - throw new Exception("检测到未保存的场景文件"); + // 检测是否有未保存场景 + if (EditorTools.HasDirtyScenes()) + throw new Exception("检测到未保存的场景文件"); - // 保存改动的资源 - AssetDatabase.SaveAssets(); + // 保存改动的资源 + AssetDatabase.SaveAssets(); + } // 增量更新时候的必要检测 - var buildMode = buildParameters.Parameters.BuildMode; if (buildMode == EBuildMode.IncrementalBuild) { // 检测历史版本是否存在