mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-30 13:38:46 +00:00
perf : webgl platform use crc verify the bundle when first time downloaded
WebGL平台首次下载会验证CRC。
This commit is contained in:
@@ -122,7 +122,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
if (_disableUnityWebCache)
|
if (_disableUnityWebCache)
|
||||||
{
|
{
|
||||||
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, 0);
|
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, Bundle.UnityCRC);
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
downloadhandler.autoLoadAssetBundle = false;
|
downloadhandler.autoLoadAssetBundle = false;
|
||||||
#endif
|
#endif
|
||||||
@@ -132,9 +132,19 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
// 注意:优先从浏览器缓存里获取文件
|
// 注意:优先从浏览器缓存里获取文件
|
||||||
// The file hash defining the version of the asset bundle.
|
// The file hash defining the version of the asset bundle.
|
||||||
uint unityCRC = Bundle.UnityCRC;
|
|
||||||
Hash128 fileHash = Hash128.Parse(Bundle.FileHash);
|
Hash128 fileHash = Hash128.Parse(Bundle.FileHash);
|
||||||
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, fileHash, unityCRC);
|
var cachedBundle = new CachedAssetBundle(Bundle.BundleName, fileHash);
|
||||||
|
if (Caching.IsVersionCached(cachedBundle))
|
||||||
|
{
|
||||||
|
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, cachedBundle, 0);
|
||||||
|
#if UNITY_2020_3_OR_NEWER
|
||||||
|
downloadhandler.autoLoadAssetBundle = false;
|
||||||
|
#endif
|
||||||
|
return downloadhandler;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, cachedBundle, Bundle.UnityCRC);
|
||||||
#if UNITY_2020_3_OR_NEWER
|
#if UNITY_2020_3_OR_NEWER
|
||||||
downloadhandler.autoLoadAssetBundle = false;
|
downloadhandler.autoLoadAssetBundle = false;
|
||||||
#endif
|
#endif
|
||||||
@@ -142,4 +152,5 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user