Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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,350
  3. Pangamini

    Pangamini

    Joined:
    Aug 8, 2012
    Posts:
    54
    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:
    368
    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,663