Browse Source

增量包优化,不重复拷贝

guodong 1 year ago
parent
commit
f330580894

+ 7 - 2
GameClient/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePackage.cs

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections.Generic;
+using System.IO;
 
 namespace YooAsset.Editor
 {
@@ -70,8 +71,12 @@ namespace YooAsset.Editor
 			int fileTotalCount = buildMapContext.Collection.Count;
 			foreach (var bundleInfo in buildMapContext.Collection)
 			{
-				EditorTools.CopyFile(bundleInfo.BundleInfo.BuildOutputFilePath, bundleInfo.BundleInfo.PackageOutputFilePath, true);
-				EditorTools.DisplayProgressBar("拷贝补丁文件", ++progressValue, fileTotalCount);
+				//判断文件已存在不更新,因为文件名中有hash值,可以保证文件最新
+				if(!File.Exists(bundleInfo.BundleInfo.PackageOutputFilePath))
+				{
+					EditorTools.CopyFile(bundleInfo.BundleInfo.BuildOutputFilePath, bundleInfo.BundleInfo.PackageOutputFilePath, true);
+					EditorTools.DisplayProgressBar("拷贝补丁文件", ++progressValue, fileTotalCount);
+				}
 			}
 			EditorTools.ClearProgressBar();
 		}