2017.3.0p2 crashes on ios when loading any png from ftp

I am loading png from an ftp server since unity 5 which has always worked fine. But now the piece of code below crashes the whole app. It has something to do with the iOS png support I guess, but this worked always for me until i updated to 2017.3.0p2 for updated Vuforia support. Last Unity version i tried this on was 2017.2.0f3, then it still worked. Has anyone else encountered this problem?

    public string ImagePath;

    void Start () {
        StartCoroutine(LoadWWWIntoImage(ImagePath));
    }
   
    private IEnumerator LoadWWWIntoImage(string url)
    {

        WWW www = new WWW(url);
        yield return www;

        // check for errors
        if (www.error == null)
        {
            //Debug.Log("WWW Ok!: " + www.data);
            Texture2D texture = www.texture;
            GetComponent<Image>().sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f);
        }
        else
        {
            Debug.Log("WWW Error: " + www.error);
        }

    }

Hi

Can you se what the error message says when this happens?
Does it work for downloading other image formats, like jpg?

If not I would test downloading using UnityWebRequest.Get or GetTexture to fetch the images.

I had to switch from www to webrequest for downloading assetbundles, though it was using http, not ftp.

Hello,

I can’t directly copy the error message right now but it shows a EXC_BAD_ACCES Code 1 on a memory adress as soon as it starts to create a Texture2D from the www. for jpg’s it doesn’t crash but still won’t load the image.

There is a slight mistake in my original post. I do use http, but the file gets downloaded from a ftp server. I have tried UnityWebRequests before but if I remember correctly they were quite a bit slower than using www’s. Still worth a try though. Thanks for the help! :slight_smile:

Tested this but the app still crashes. I do not have problems with loading jpg with this though.

Hi twinsense360, I have the same error on 2017.3.0p2, it crashes always when i’m using PNG images on iOS, but JPG works fine. Right now I’m updating Unity to 2017.3.0p4 and I will answer tomorrow (I HOPE IT WILL BE FIXED :slight_smile: ).

No way, for now I’m using only jpegs in project, and I have an image picker that picks image for avatar from users device, if its png I automatically convert it to jpeg via plugin

Won’t you have problems with transparancy? Cause in our app transparancy is needed in some cases. Lets hope the Unity developers picks this up at some point (hopefully before v2018).

What is the plugin you are using? We can maybe use it as a temporary fix.

Same here. Fetched pngs from server, stored in Application.persistantDatapath, later load from there (tried loading with www, File.load etc) - BOOOM.

Works fine in Editor.

Changed to jpg for now, which works.

Anybody filed a bug report?

We are having the same issue with loading a png which has been downloaded via WWW using Unity 2017.3, Unity 2017.2 worked fine.

I did not find an issue in issue tracker about this, is there really no issue being reported yet?

i didnt found the time yet to do this. But it’s still in my planning :slight_smile:

Having same issue loading PNG images. Issue occurs only when XR settings is enables and cardboard is added to the list. If I remove cardboard then it works fine.

They plan to fix it in unity 2018.2. I tried it in an empty project without XR settings i still had the same problem though.

Oh well, lets just wait patiently for Unity to fix this problem. For now i’m only using jpegs.

This is a known issue: https://github.com/googlevr/gvr-unity-sdk/issues/878

This should be fixed in:
Latest 2018.1
2017.4.1f1
2017.2.2p3
2017.1.3p3

I upgraded my project to 2017.4.1f1 and its working fine now.