1
我正在尝试为多个assetbundle创建一个下载进度条。所有资产包的总大小通过添加webRequest.GetResponseHeader("Content-Length")
来计算。但www.downloadProgress
只返回从0到1的值。在单个进度条中下载多个unity3d assetbundle?
这里的示例代码:
float progress = 0;
for (int i = 0; i < assetToDownload.Count; i++)
{
UnityWebRequest www = UnityWebRequest.GetAssetBundle(assetToDownload[i], 0, 0);
www.Send();
while (!www.isDone)
{
progress += www.downloadProgress * 100;
Debug.Log((progress/totalSize) * 100);
yield return null;
}
}