Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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:
    6,387
  3. Pangamini

    Pangamini

    Joined:
    Aug 8, 2012
    Posts:
    49
    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. }
     
    Marcos-Elias, AL_W and saucer_attack like this.
  5. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    302
    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:
    7
    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:
    11
    Code (CSharp):
    1. UnityWebRequest www = UnityWebRequest.Post(BASE_URL, rawData);
    2. yield return www.SendWebRequest();
     
unityunity