Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

`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,635
    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