diff --git a/Assets/YooAsset/Runtime/AssetsPackage.cs b/Assets/YooAsset/Runtime/AssetsPackage.cs
index 2fe153e..7ebd654 100644
--- a/Assets/YooAsset/Runtime/AssetsPackage.cs
+++ b/Assets/YooAsset/Runtime/AssetsPackage.cs
@@ -202,7 +202,8 @@ namespace YooAsset
/// 向网络端请求最新的资源版本
///
/// 超时时间(默认值:60秒)
- public UpdatePackageVersionOperation UpdatePackageVersionAsync(int timeout = 60)
+ /// 在URL末尾添加时间戳
+ public UpdatePackageVersionOperation UpdatePackageVersionAsync(int timeout = 60, bool appendTimeTicks = true)
{
DebugCheckInitialize();
if (_playMode == EPlayMode.EditorSimulateMode)
@@ -219,7 +220,7 @@ namespace YooAsset
}
else if (_playMode == EPlayMode.HostPlayMode)
{
- return _hostPlayModeImpl.UpdatePackageVersionAsync(PackageName, timeout);
+ return _hostPlayModeImpl.UpdatePackageVersionAsync(PackageName, timeout, appendTimeTicks);
}
else
{
diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageVersionOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageVersionOperation.cs
index 56c0dd5..054ac65 100644
--- a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageVersionOperation.cs
@@ -60,14 +60,16 @@ namespace YooAsset
private readonly HostPlayModeImpl _impl;
private readonly string _packageName;
private readonly int _timeout;
+ private readonly bool _appendTimeTicks;
private ESteps _steps = ESteps.None;
private UnityWebDataRequester _downloader;
- internal HostPlayModeUpdatePackageVersionOperation(HostPlayModeImpl impl, string packageName, int timeout)
+ internal HostPlayModeUpdatePackageVersionOperation(HostPlayModeImpl impl, string packageName, int timeout, bool appendTimeTicks)
{
_impl = impl;
_packageName = packageName;
_timeout = timeout;
+ _appendTimeTicks = appendTimeTicks;
}
internal override void Start()
{
@@ -130,8 +132,11 @@ namespace YooAsset
else
url = _impl.GetPatchDownloadMainURL(fileName);
- // 注意:在URL末尾添加时间戳
- return $"{url}?{System.DateTime.UtcNow.Ticks}";
+ // 在URL末尾添加时间戳
+ if (_appendTimeTicks)
+ return $"{url}?{System.DateTime.UtcNow.Ticks}";
+ else
+ return url;
}
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs
index 39a8d88..db6e114 100644
--- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs
+++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs
@@ -44,9 +44,9 @@ namespace YooAsset
///
/// 异步更新资源版本号
///
- public UpdatePackageVersionOperation UpdatePackageVersionAsync(string packageName, int timeout)
+ public UpdatePackageVersionOperation UpdatePackageVersionAsync(string packageName, int timeout, bool appendTimeTicks)
{
- var operation = new HostPlayModeUpdatePackageVersionOperation(this, packageName, timeout);
+ var operation = new HostPlayModeUpdatePackageVersionOperation(this, packageName, timeout, appendTimeTicks);
OperationSystem.StartOperation(operation);
return operation;
}