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

[UnityWebRequest] Pause and resume

Discussion in 'Multiplayer' started by Wattosan, Jun 27, 2019.

  1. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    456
    Hello,

    Is it possible to somehow pause the download process of the UnityWebRequest and at a later point in time, continue the download process. I am downloading large files (>2GB) and need to pause the download for around 10-15 minutes, after which the download should resume. I need the bandwidth for other purposes during that time.

    Thanks!
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Have you considered breaking the files up into smaller chunks, and recombining them when they are all downloaded?
     
  3. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
    No, UnityWebRequest does not have the pause capability. But if your server supports ranged requests, you should make use of those.
     
    EirikWahl and Wattosan like this.
  4. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    456
    Thanks for the answer!

    How would I make use of those Unity side?
     
  5. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
    Ranged requests is HTTP feature and are used via HTTP headers. From Unity side it's a matter of calling SetRequestHeader on UWR, but exact details lookup HTTP spec and make sure your server does support ranged requests.
     
    Wattosan likes this.