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 progress

Discussion in 'Multiplayer' started by danielgsantana, Apr 17, 2015.

  1. danielgsantana

    danielgsantana

    Joined:
    Mar 11, 2015
    Posts:
    24
    Hi, is it me or when using something like this, it blocks the mainthread and it used to not block in unity 3/4?

    public IEnumerator Test(string url, float timeout)
    {
    var www = new WWW(url);
    while (!www.isDone)
    {
    BytesDownloaded = www.bytesDownloaded;
    Percent = www.progress;
    _progressReport(Percent, BytesDownloaded, www.error);
    if (Time.deltaTime - timer > timeout && !www.isDone)
    {
    Error = "Timeout accessing url.";
    break;
    }
    if (!string.IsNullOrEmpty(www.error))
    {
    Error = www.error;
    break;
    }
    yield return new WaitForFrameEnd();
    }
    }