Search Unity

2017.3.0p2 crashes on ios when loading any png from ftp

Discussion in 'Scripting' started by TotalReality, Jan 24, 2018.

  1. TotalReality

    TotalReality

    Joined:
    Oct 13, 2016
    Posts:
    11
    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?

    Code (CSharp):
    1.     public string ImagePath;
    2.  
    3.     void Start () {
    4.         StartCoroutine(LoadWWWIntoImage(ImagePath));
    5.     }
    6.    
    7.     private IEnumerator LoadWWWIntoImage(string url)
    8.     {
    9.  
    10.         WWW www = new WWW(url);
    11.         yield return www;
    12.  
    13.         // check for errors
    14.         if (www.error == null)
    15.         {
    16.             //Debug.Log("WWW Ok!: " + www.data);
    17.             Texture2D texture = www.texture;
    18.             GetComponent<Image>().sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f);
    19.         }
    20.         else
    21.         {
    22.             Debug.Log("WWW Error: " + www.error);
    23.         }
    24.  
    25.     }
     
  2. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    782
    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.
     
    Last edited: Jan 25, 2018
  3. TotalReality

    TotalReality

    Joined:
    Oct 13, 2016
    Posts:
    11
    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! :)
     
  4. TotalReality

    TotalReality

    Joined:
    Oct 13, 2016
    Posts:
    11
    Tested this but the app still crashes. I do not have problems with loading jpg with this though.
     
  5. NovaSurfer

    NovaSurfer

    Joined:
    May 18, 2014
    Posts:
    11
    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 :) ).
     
  6. NovaSurfer

    NovaSurfer

    Joined:
    May 18, 2014
    Posts:
    11
    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
     
  7. TotalReality

    TotalReality

    Joined:
    Oct 13, 2016
    Posts:
    11
    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.
     
    Last edited: Feb 5, 2018
  8. Deleted User

    Deleted User

    Guest

    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?
     
  9. MarblXR70

    MarblXR70

    Joined:
    Sep 3, 2017
    Posts:
    3
    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?
     
  10. TotalReality

    TotalReality

    Joined:
    Oct 13, 2016
    Posts:
    11
    i didnt found the time yet to do this. But it's still in my planning :)
     
  11. mehtanitish

    mehtanitish

    Joined:
    Mar 22, 2016
    Posts:
    14
    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.
     
  12. TotalReality

    TotalReality

    Joined:
    Oct 13, 2016
    Posts:
    11
    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.
     
  13. mehtanitish

    mehtanitish

    Joined:
    Mar 22, 2016
    Posts:
    14
    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.