瀏覽代碼

增量包优化,不重复拷贝

guodong 1 年之前
父節點
當前提交
f330580894
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      GameClient/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePackage.cs

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

@@ -1,5 +1,6 @@
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.IO;
 
 
 namespace YooAsset.Editor
 namespace YooAsset.Editor
 {
 {
@@ -70,8 +71,12 @@ namespace YooAsset.Editor
 			int fileTotalCount = buildMapContext.Collection.Count;
 			int fileTotalCount = buildMapContext.Collection.Count;
 			foreach (var bundleInfo in buildMapContext.Collection)
 			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();
 			EditorTools.ClearProgressBar();
 		}
 		}