Unity-Technologies / Addressables-Sample

Demo project using Addressables package
1.29k stars 298 forks source link

How to resume download #44

Open Friend-0x41 opened 4 years ago

Friend-0x41 commented 4 years ago

I use DownloadDependenciesAsync to download assets. It doesn't work when I reset network, I hold an AsyncOperationHandler and it's TaskStatus is WaittingToRun. How can I resume download or stop the AsyncOperationHandler. Thanks a lot!

kirstenpilla commented 2 years ago

Hi @Friend-0x41 unfortunately downloading pausing is not supported:

We use UnityWebRequest that does not support pausing. It is possible to create a completely new AssetBundleProvider implementation that is based on HttpClient and enable this. This would be fairly involved and in order to support streaming loads you would need to implement a custom memory stream that wrapped the one provided by HttpClient (this is due to the requirement that Seek is available in the stream).

yiwei151 commented 1 year ago

你好,我也遇到这种问题,在微信小游戏中,偶尔会出现资源下载到90%几然后就一直不会继续下载了,status也没成功也没失败,完成回调也没有调用,请问这个要如何解决?我使用GetDownloadStatus()获取了下载长度,发现下载长度一直没有改变。

Friend-0x41 commented 1 year ago

你好,我也遇到这种问题,在微信小游戏中,偶尔会出现资源下载到90%几然后就一直不会继续下载了,status也没成功也没失败,完成回调也没有调用,请问这个要如何解决?我使用GetDownloadStatus()获取了下载长度,发现下载长度一直没有改变。

当时我的解决办法是重新再走一遍下载的逻辑,已下载的内容会被缓存,只下载需要更新的部分,当下载进度长时间不变就可以结束下载线程重新开始下载,但是addressable没有结束下载的接口(最新版本我不确定,接近三年没摸过了),需要更改addressable源码以结束下载进程