Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

UnityWebRequest inconsistent API

Discussion in '5.4 Beta' started by bdovaz, Feb 6, 2016.

  1. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    I suppose that the objetive is that UnityWebRequest replaces WWW. To do that you need to provide the same API.

    Now we have a problem. As 5.4b4 we can:

    public static UnityWebRequest GetAudioClip(string uri, AudioType audioType);
    public static UnityWebRequest GetTexture(string uri);
    public static UnityWebRequest GetTexture(string uri, bool nonReadable);

    But there is no:

    public static UnityWebRequest GetTexture(string uri, TextureFormat textureFormat);
    public static UnityWebRequest GetTexture(string uri, TextureFormat textureFormat, bool nonReadable);

    I assume that you create a ARGB32 Texture but sometimes we want another format that with WWW was possible to do.

    http://docs.unity3d.com/ScriptReference/WWW.LoadImageIntoTexture.html

    "This function replaces texture contents with downloaded image data, so texture size and format might change. JPG files are loaded intoRGB24 format, PNG files are loaded into ARGB32 format. If texture format before calling LoadImage is DXT1 or DXT5, then the loaded image will be DXT-compressed (into DXT1 for JPG images and DXT5 for PNG images)."

    And also there is no:

    public static UnityWebRequest GetMovieTexture(string uri);
     
  2. Alex-Lian

    Alex-Lian

    Guest

    Passed along to Justinas, so duly noted. Thanks!
     
  3. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    Thanks Alex!
     
  4. Cuicui_Studios

    Cuicui_Studios

    Joined:
    May 3, 2014
    Posts:
    72
    Hi! I´m having troubles with the new class too. I´m using it for better performance on images download from my host, and the performance is much better with the new method. But I can´t save this new textures with the "EncodeToPng()" function. It said that texture is not Readable, but with the WWW class it works.

    Do you know how to save locally this new textures? Thanks!

    Gabriel.