Hi,
I have been searching the right way to download multiple pictures or repeatedly the same (changing) picture from an url.
All the examples I have found download only one picture by IEnumerator Start function.
The following script works on Editor and on other platform devices (Android, WP) but not on iPod Touch.
I don’t have right now any other iOS test devices to try. Could someone test it on iPhone or iPad?
1629479–100230–$Example.cs (960 Bytes)
usingUnityEngine;
usingSystem.Collections;
publicclassExample : MonoBehaviour {
//Thisscriptisattachedtoaplaneobject
stringurl = “http://unity3d.com/profiles/unity3d/themes/unity/images/company/brand/logos/primary/unity.jpg”;
WWWimageFile;
publicGUITextgt;
publicboolimageLoaded;
IEnumeratorStart() { //THISWORKSONiPodTouchandtheimageisshown
imageFile = newWWW (url);
yieldreturnimageFile;
renderer.material.mainTexture = imageFile.texture;
}
voidUpdate() { //BUTTHISDOESNOT*!* Theimageisnotshown*.* imageFile*.isDoneisfalseforever**…*
if (Time.frameCount % 180 == 0) {
imageLoaded = false;
imageFile = newWWW (url);
while (!imageFile.isDone) {
*//print (url);
//gt.text = Time.frameCount.ToString(); // imageFile.bytesDownloaded.*ToString ();
imageLoaded = true;
}
renderer.material.mainTexture = imageFile.texture;
gt.text = imageFile.url;
}
}
}