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;
}
}