I'm trying to download an assetbundle using Unity Web Request and show the progress, according to the documentation i need to capture a WebRequestAsyncOperation object to find the progress but i cannot find it
I tried using AsyncOperation and UnityWebRequestAsyncOperation and my routine works with both, what is the difference of using one or another?
here is my code:
IEnumerator DownloadModel3D()
{
using (UnityWebRequest uwr = UnityWebRequest.GetAssetBundle(bundleURL,1,0))
{
//UnityWebRequestAsyncOperation request = uwr.SendWebRequest();
AsyncOperation request = uwr.SendWebRequest();
while (!request.isDone)
{
Debug.Log(request.progress);
yield return null;
}
if (uwr.isNetworkError || uwr.isHttpError)
{
Debug.Log(uwr.error);
}
else
{
// Get downloaded asset bundle
AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(uwr);
assetBundleInstance = Instantiate(bundle.LoadAsset(assetName)) as GameObject;
assetBundleInstance.transform.position = transform.position;
assetBundleInstance.transform.localScale = new Vector3(.08f, .08f, .08f);
assetBundleInstance.transform.SetParent(transform);
contador.text = "Descargado: " + assetName + "\n" + bundleURL;
}
}
}