diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs index 8e29424..764912c 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs @@ -89,9 +89,9 @@ namespace YooAsset.Editor /// /// 获取构建的耗时(单位:秒) /// - public int GetBuildingSeconds() + public float GetBuildingSeconds() { - int seconds = (int)(_buildWatch.ElapsedMilliseconds / 1000); + float seconds = _buildWatch.ElapsedMilliseconds / 1000f; return seconds; } public void BeginWatch() @@ -139,9 +139,9 @@ namespace YooAsset.Editor bool succeed = BuildRunner.Run(pipeline, _buildContext); if (succeed) - Debug.Log($"{buildParameters.BuildMode}模式构建成功!"); + Debug.Log($"{buildParameters.BuildMode} pipeline build succeed !"); else - Debug.LogWarning($"{buildParameters.BuildMode}模式构建失败!"); + Debug.LogWarning($"{buildParameters.BuildMode} pipeline build failed !"); return succeed; } } diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildSystem/BuildRunner.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildSystem/BuildRunner.cs index aac7f3e..0862b00 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildSystem/BuildRunner.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildSystem/BuildRunner.cs @@ -45,14 +45,22 @@ namespace YooAsset.Editor } /// - /// 普通日志输出 + /// 日志输出 /// public static void Log(string info) { if (EnableLog) { UnityEngine.Debug.Log(info); - } + } + } + + /// + /// 日志输出 + /// + public static void Info(string info) + { + UnityEngine.Debug.Log(info); } } } \ No newline at end of file diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs index f05c882..3b457ab 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs @@ -12,20 +12,30 @@ namespace YooAsset.Editor { var buildParameters = context.GetContextObject(); var buildMapContext = context.GetContextObject(); - CreateReportFile(buildParameters, buildMapContext); + buildParameters.StopWatch(); + + var buildMode = buildParameters.Parameters.BuildMode; + if (buildMode != EBuildMode.SimulateBuild) + { + CreateReportFile(buildParameters, buildMapContext); + } + else + { + float buildSeconds = buildParameters.GetBuildingSeconds(); + BuildRunner.Info($"Build time consuming {buildSeconds} seconds."); + } } private void CreateReportFile(AssetBundleBuilder.BuildParametersContext buildParameters, BuildMapContext buildMapContext) { PatchManifest patchManifest = AssetBundleBuilderHelper.LoadPatchManifestFile(buildParameters.PipelineOutputDirectory, buildParameters.Parameters.BuildVersion); - BuildReport buildReport = new BuildReport(); - buildParameters.StopWatch(); + BuildReport buildReport = new BuildReport(); // 概述信息 { buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion; buildReport.Summary.BuildTime = DateTime.Now.ToString(); - buildReport.Summary.BuildSeconds = buildParameters.GetBuildingSeconds(); + buildReport.Summary.BuildSeconds = (int)buildParameters.GetBuildingSeconds(); buildReport.Summary.BuildTarget = buildParameters.Parameters.BuildTarget; buildReport.Summary.BuildMode = buildParameters.Parameters.BuildMode; buildReport.Summary.BuildVersion = buildParameters.Parameters.BuildVersion; diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs index 536325b..f54a8e1 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs @@ -89,6 +89,13 @@ namespace YooAsset.Editor /// public List GetAllCollectAssets(AssetBundleCollectorGroup group) { + // 注意:模拟构建模式下只收集主资源 + if (AssetBundleCollectorSetting.BuildMode == EBuildMode.SimulateBuild) + { + if (CollectorType != ECollectorType.MainAssetCollector) + return new List(); + } + Dictionary result = new Dictionary(1000); bool isRawAsset = PackRuleName == nameof(PackRawFile);