Coroutine doesn't finish on Android, works fine on Windows.

Hi.

I’m seriously stumped here. I have a coroutine that uses the WWW class to download some base64-encoded images and then converts them to sprites. In pseudocode:

 IEnumerator DownloadAndConvert(List<Images> list) {
 
     foreach (item in list) {
         newItem = DoDownload(item)
         AddItemToListOfUnconvertedImages(newItem);
     }
 
     foreach (item in unconvertedImages) {
         img = ConvertFromBase64ToImage(item);
         sprite = MakeASprite(img);
         AddSpriteToList(spriteList);
     }
 
     Print("Conversion finished.");
     ShowIntroVideo();
 }

(Actual code below)
Now on Windows this runs fine all the way to the end. On Android however, it never reaches the Print statement, just executes the two loops above (with no errors, the images are displayed in the application).

I’d be pulling my hair just about now if I had any. I’m certain the object that starts the coroutine still exists by the time the coroutine ends, so it doesn’t hang on yield. There’s plenty of similar code in coroutines thrown all around that app and all of it works, apart from this piece.

Any and all help will be greatly appreciated.

    IEnumerator GetImageQueued(List<ImageToGet> list)
    {
        Debug.Log("<b>Image queuee elements: </b>" + list.Count.ToString());
        LiveLogger.instance.AddLog("GetImageQueued starting.");
        for (int i = 0; i < list.Count; i++)
        {
            ImageToGet x = list*;*

WWWForm form = new WWWForm();
form.AddField(“action”, “get_image”);
form.AddField(“id”, x.drinkId);
form.AddField(“which”, x.which);

WWW www = new WWW(url, form);

while (www.isDone == false)
yield return new WaitForEndOfFrame();

//yield return www;
string error = www.error;
string text = www.text;

if (www.error != null)
LiveLogger.instance.AddLog("Image " + +x.num + x.drinkId + x.which + " downloading error! " + www.error.ToString());

unconvertedImages.Add(text);

}

yield return new WaitForSeconds(.1f);

int imagesConverted = 0;
int imagesToConvert = list.Count;

Debug.Log(“Converting and assigning images.”);
for (int i = 0; i < unconvertedImages.Count; i++)
{
ImageToGet x = list*;*
LiveLogger.instance.AddLog("Starting conversion of image " + (imagesConverted + 1) + " of " + imagesToConvert);
Sprite imgTemp = ConvertTextToPNG(unconvertedImages*);*
if (x.num < Menu.instance.recipes.Count && x.which < Menu.instance.recipes[x.num].images.Length)
{
Menu.instance.recipes[x.num].images[x.which] = imgTemp;
}

//PlayerPrefs.SetString(“r” + x.num + “i” + x.which, unconvertedImages*);*

if (x.which != 4 && RecipePopUp.instance.gameObject.activeSelf && x.num == Menu.instance.current)
{
RecipePopUp.instance.RefreshGoodSprites(false);
}

if (Menu.instance.gameObject.activeSelf && x.which == 4)
{
Menu.instance.ChangeRecipeSprite(x.drinkId, imgTemp);
}

imagesConverted++;

LiveLogger.instance.AddLog(“End of Conversion interation.”);
yield return new WaitForEndOfFrame();
}
LiveLogger.instance.AddLog(“All images converted, launching vid.”);
Intro.instance.ShowIntroVideo();

}

I have a similar problem. Did you find the problem and solution for this?,Did you find the problem and solution for this?