Search Unity

`yield return www.SendWebRequest();` takes a really long time

Discussion in 'Scripting' started by ledlamp, Mar 26, 2018.

  1. ledlamp

    ledlamp

    Joined:
    Apr 19, 2017
    Posts:
    5
    when using UnityWebRequest.Post() like so:
    Code (csharp):
    1. using (var www = UnityWebRequest.Post(uri, form)) {
    2.     yield return www.SendWebRequest();
    3. }
    it takes a really long time for code after the yeild to run, even though the actual upload finished quickly after it started, and www.uploadProgress is 1. :confused:
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    uploadProgress 1 means all data has been sent. However, POST request means not only sending data to the server, but also receiving response from it. The next line after yield return is executed after response has been received from server.
     
  3. ledlamp

    ledlamp

    Joined:
    Apr 19, 2017
    Posts:
    5
    Oh I see, so there must be an issue with the server.

    Edit: Yep, the server wasn't ending the request. :rolleyes:
     
    Last edited: May 19, 2018