Skip to content

jpgordon00/UnityFileDownloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

UnityFileDownloader☁️

downloads License: MIT

A file downloader that handles asyncronous and concurrent file downloading, implicit multi-part file downloading, pausing/restarting, properties with per-file granularity and more.

Appendix

This file downloader was built because UnityWebRequest and recent solutions built by Unity and third-parties are subpar and bare of features. While this project is written 100% in C#, this downloader should support all platforms that Unity does. If you have any feedback, please reach out to me at [email protected], or submit an issue or pull request. Collaboration is encouraged!

Features

  • Concurrently download any amount of files while adhering to a fixed number of asyncronous tasks
  • Implicitly handles multi-part file downloading, including pausing/restarting of chunked downloads
  • Provides both task-based asyncronous methods and standard callbacks for errors, individual file completion, all file completion, and more
  • Granularity of properties can be on a per-file basis, providing the ability to pause/restart, and to get/set progress, timeouts, headers, callbacks and more
  • Optionally handle "atomic" file downloading by deleting all downloaded (partially or impartially) files and ability to continue downloading through HTTP/S errors
  • Code structure that allows for modularity of both download fulfillment (such as UnityWebRequest) and dispatching of downloads.

Usage/Examples

using UFD;
using System;

// ... in some class
public class Example
{
    async void Download()
    {
        UnityFileDownloader ufd = new UnityFileDownloader(new string[] {
            "https://wallpaperaccess.com/full/87731.jpg",
        });
        await ufd.Download();
    }

}

Issues

  • Unity Editor termination and application lifecycle methods do not stop this downloader from functioning.

TODO

The following features are some of which I deem to be deseriable and not currently implemented:

  • Dynamic chunk sizing based on download speeds
  • Cleanup of class structure to provide complete modularity of download fulfillment and downloader.
  • Provide alternative fulfillers to UnityWebRequest, perhaps unlocking better platform specific performance.

About

Download multiple files at a time in Unity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages