UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(savePath, manifest.GetAssetBundleHash(bundleName), 0);
yield return request.SendWebRequest();
while (!bundle.isDone)
{
yield return new WaitForEndOfFrame();
}
yield return new WaitForEndOfFrame();
if (bundle.error != null)
{
loadingFlag = false;
}
else
{
var newHash = manifest.GetAssetBundleHash(bundleName);
Caching.MarkAsUsed(savePath, newHash);
AssetBundleManager.LoadedAssetBundles.Add(bundleName, new LoadedAssetBundle(bundle.assetBundle));
Please contact us regarding bundle storage.
The code works fine on mobile and works fine on many PCs in WEBGL as well.
However, in some PCs, when downloading a bundle from 'bundle.isDone' or 'bundle.downloadHandler.isDone' in WebGL, isDone True occurs when the network download is complete, and the next bundle is downloaded, and the previous bundle only resides in memory and the file is not created repeatedly. There is a phenomenon that the file is not created after the memory is raised very significantly and actually bounces due to an Out of Memory error.
When applying heahCode in UnityWebRequestAssetBundle.GetAssetBundle, I know that bundle.isDone or bundle.downloadHandler.isDone occurs True when the file is created in IndexedDB.
Is there a cause and a solution?
↧