How to load 60 remote images in unity 5?

1

I'm trying to load 60 remote images from a JSON file, such as textures of a prefab , into three steps of 20 images. However, I can only load 15.

My code below.

public IEnumerator SetGallery (List<string> Thumbnails,GameObject[] Photos)
{
    int cont = 0;
    string aux = "";
    /*while (!Caching.ready)
        yield return null;*/

    foreach (GameObject image in Photos) {
            if (cont < sizePerGallery) {
                aux = Thumbnails [cont];
                WWW www = new WWW (aux);
                yield return new WaitForSeconds(.5f);
                Renderer renderer = GetComponent<Renderer> ();
                renderer.material.mainTexture = www.texture;
                image.GetComponent<Renderer> ().material.mainTexture =  www.texture;
                www.LoadImageIntoTexture(image.GetComponent<Renderer> ().material.mainTexture as Texture2D);
                DestroyImmediate (www.texture);
                www.Dispose();
                System.GC.Collect ();
                cont++;
            }
    }
}

And I always have errors in the download.

    
asked by anonymous 17.02.2016 / 14:32

0 answers