Hello. I’m having difficulty tracking progress using a WWW class. On mobile platforms WWW.progress value does not change linearly, it is 0 (when loading) or 1 (when the finish).
On PC & MAC all Ok. I mean that the PC value goes smoothly from 0 to 1 (0.1 0.2 0.3 … 1). But on mobile platforms this is not happening! Is 0 or 1, no 0.2 0.4 etc… Rigidly 0 or 1. Help! Unity 4.3.0f4 Pro
using UnityEngine;
using System.Collections;
public class ExampleLoadingBundle : MonoBehaviour {
public string url = "http://pancrucian.littleteam.ru/myAssetBundle.unity3d";
public int version = 1; // The version of the AssetBundle
public string assetName = "Object Name";
public tk2dTextMesh textMesh;
public AudioSource ObjInstance;
void Start(){
StartCoroutine(LoadBundle<AudioClip>(url, version,assetName));
}
public IEnumerator LoadBundle<T> (string url, int version, string assetName) where T : Object {
using(WWW download = WWW.LoadFromCacheOrDownload(url, version)){
while(!download.isDone) {
textMesh.text = download.progress.ToString(); // THIS PART NOT WORKING, PROGRESS ALWAYS 0 THEN 1 IF download.isDone
textMesh.Commit();
yield return 0;
}
yield return download;
if (download.error != null) {
textMesh.text = download.error;
download.Dispose();
textMesh.Commit ();
yield break;
}
AssetBundle assetBundle = download.assetBundle;
download.Dispose();
if (assetName == "" || assetName == null)
ObjInstance.clip = (AudioClip)assetBundle.mainAsset;
else
ObjInstance.clip = (AudioClip)assetBundle.Load(assetName, typeof(T));
assetBundle.Unload(false);
}
ObjInstance.Play();
}
}