Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

WWW marked as obsolete???

Discussion in 'Documentation' started by khalvr, Jan 3, 2019.

  1. khalvr

    khalvr

    Joined:
    Sep 12, 2017
    Posts:
    53
    I'm looking at the entry for the WWW class in the manual, and it is marked as "obsolete" in both 2018.3 and 2019.1. Why?? I'm using WWW in 2018.3 and there are no errors popping up about it being obsolete. Is there a replacement planned for this functionality, or is it just an error in the documentation?
     
    ina likes this.
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,566
  3. Pangamini

    Pangamini

    Joined:
    Aug 8, 2012
    Posts:
    55
    What replacement should we use to load assets from files? Before, we'd use WWW with file:// protocol
     
  4. khalvr

    khalvr

    Joined:
    Sep 12, 2017
    Posts:
    53
    You can use UnityWebRequest in the same way.

    Code (CSharp):
    1. UnityWebRequest www = UnityWebRequest.Get(myFileURI);
    2. yield return www.SendWebRequest();
    3.  
    4. if (!www.isNetworkError && !www.isHttpError) {
    5.     // Get text content like this:
    6.     Debug.Log(www.downloadHandler.text);
    7. }
     
  5. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    380
    Will this stop working one day if you have it implemented with WWW or can my game continue without updating anything?
     
  6. khalvr

    khalvr

    Joined:
    Sep 12, 2017
    Posts:
    53
    WWW will probably be deprecated in a future Unity version, but if you don't update the editor then it will always work. The WebRequest system is very similar to WWW though, so refactoring should not be a big issue.
     
  7. talosbilisim

    talosbilisim

    Joined:
    Jul 2, 2020
    Posts:
    1
    I used WWW class in my game. It works normally properly. But it doesn't work at all on some android versions. Could this be because it is obsolete? It runs on Android 7. Android 11 didn't work either.
     
  8. khanhabib

    khanhabib

    Joined:
    Oct 11, 2018
    Posts:
    29
    Can someone help me please how to replace these lines of codes to UnityWebRequest.

    WWW www = new WWW(BASE_URL, rawData);
    yield return www;


    Thanks
     
  9. bharath09vadde

    bharath09vadde

    Joined:
    Nov 23, 2017
    Posts:
    12
    Code (CSharp):
    1. UnityWebRequest www = UnityWebRequest.Post(BASE_URL, rawData);
    2. yield return www.SendWebRequest();
     
    osama2o1ooo likes this.
  10. sheikh_Ati

    sheikh_Ati

    Joined:
    Sep 29, 2016
    Posts:
    2
    www request still the best since unity web request multimedia will not get a flac file form the url but the www will..
     
  11. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,670