update runtime code

新增方法YooAssets.SetCacheSystemDisableCacheOnWebGL()
pull/134/head
hevinci 2023-06-28 17:46:32 +08:00
parent 3ca300d956
commit f5c72e913f
3 changed files with 26 additions and 4 deletions

View File

@ -167,12 +167,21 @@ namespace YooAsset
// 5. 从WEB网站获取AssetBundle文件 // 5. 从WEB网站获取AssetBundle文件
if (_steps == ESteps.LoadWebFile) if (_steps == ESteps.LoadWebFile)
{
if (CacheSystem.DisableUnityCacheOnWebGL)
{
_webRequest = UnityWebRequestAssetBundle.GetAssetBundle(FileLoadPath);
_webRequest.SendWebRequest();
_steps = ESteps.CheckLoadWebFile;
}
else
{ {
var hash = Hash128.Parse(MainBundleInfo.Bundle.FileHash); var hash = Hash128.Parse(MainBundleInfo.Bundle.FileHash);
_webRequest = UnityWebRequestAssetBundle.GetAssetBundle(FileLoadPath, hash); _webRequest = UnityWebRequestAssetBundle.GetAssetBundle(FileLoadPath, hash);
_webRequest.SendWebRequest(); _webRequest.SendWebRequest();
_steps = ESteps.CheckLoadWebFile; _steps = ESteps.CheckLoadWebFile;
} }
}
// 6. 检测AssetBundle加载结果 // 6. 检测AssetBundle加载结果
if (_steps == ESteps.CheckLoadWebFile) if (_steps == ESteps.CheckLoadWebFile)

View File

@ -10,6 +10,11 @@ namespace YooAsset
{ {
private readonly static Dictionary<string, PackageCache> _cachedDic = new Dictionary<string, PackageCache>(1000); private readonly static Dictionary<string, PackageCache> _cachedDic = new Dictionary<string, PackageCache>(1000);
/// <summary>
/// 禁用Unity缓存系统在WebGL平台
/// </summary>
public static bool DisableUnityCacheOnWebGL = false;
/// <summary> /// <summary>
/// 初始化时的验证级别 /// 初始化时的验证级别
/// </summary> /// </summary>

View File

@ -258,6 +258,14 @@ namespace YooAsset
PersistentTools.OverwriteSandboxPath(sandboxPath); PersistentTools.OverwriteSandboxPath(sandboxPath);
} }
/// <summary>
/// 设置缓存系统参数禁用缓存在WebGL平台
/// </summary>
public static void SetCacheSystemDisableCacheOnWebGL()
{
CacheSystem.DisableUnityCacheOnWebGL = true;
}
#endregion #endregion
#region 沙盒相关 #region 沙盒相关