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

Problems upgrading from WWW to UnityWebRequest

Discussion in 'Scripting' started by ElnuDev, Apr 26, 2020.

  1. ElnuDev

    ElnuDev

    Joined:
    Sep 24, 2017
    Posts:
    298
    I'm having problems upgrading from
    WWW
    to
    UnityWebRequest
    . For some reason, my code is only working with
    WWW
    . What I'm doing to upgrade is replacing
    WWW www = new WWW(webURL);
    with
    UnityWebRequest www = UnityWebRequest.Get(webURL);
    and
    www.text
    with
    www.downloadHandler.text
    . Is there anything else I need to do?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    Check out some examples of the newer system. It's a little different. For one you have to yield the Send() method or the SendRequest() method rather than just the www object.
     
    ElnuDev likes this.
  3. ElnuDev

    ElnuDev

    Joined:
    Sep 24, 2017
    Posts:
    298
    Thanks so much! Replacing
    yield return www;
    with
    yield return www.SendWebRequest();
    fixed the issue.
     
    Kurt-Dekker likes this.