Eu estou tentando carregar 60 imagens remotas de um arquivo JSON, como texturas de um prefab
, em três etapas de 20 imagens. Porém, só consigo carregar 15.
Meu código abaixo.
public IEnumerator SetGallery (List<string> Thumbnails,GameObject[] Photos){
int cont = 0;
string aux = "";
foreach (GameObject image in Photos) {
if (cont < sizePerGallery) {
aux = Thumbnails [cont];
WWW www = new WWW (aux);
yield return www;
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);
www.Dispose();
www = null;
cont++;
}
}
}
E sempre tenho erros no download.
Obrigada pela ajuda.