Runtime Files Downloader is a plugin for Unreal Engine which allows you to download any files via the HTTP protocol to the device memory. It's easy to use in both C++ and Blueprints.
How to install
There're two ways to install the plugin:
- Through the marketplace.
- Manual installation. Open this GitHub Repository, extract the "RuntimeFilesDownloader" folder into your plugins project folder to get the following path: "[ProjectName] / Plugins / RuntimeFilesDownloader".
How to use
I will use an example setting in Blueprints to understand how the plugin works. This can also be applied in C++.
1. You need to create a download object using the CreateDownloader node.
2. You need to pull the return value from the "CreateDownloader" node and call the "DownloadFile" node, where you need to specify the following input variables:
- URL. The file URL to be downloaded
- Save Path. The absolute path and file name to save the downloaded file
- TimeOut. Maximum waiting time in case of zero download progress, in seconds
Then you need to bind to two events:
1. To the download process ("Bind Event to OnProgress"). This event will be triggered every time the file is downloaded at a certain value (needed in order to track the download). The return values contain the variables:
- Bytes Send. How many bytes were sent.
- Bytes Recieved. How many bytes were received
- Content Length.The length of the content of the currently downloaded file
Divide "Bytes Received" by "Content Length" to get the download percentage.
2. To complete the download ("Bind Event to OnResult"). This event will be triggered when the download is complete. However, this event can also be caused by an error during download, to track this you need to use the "DownloadResult Enum" in the return value and check the value of the result:
- Success. When the file was saved successfully
- Download Failed. When an error occurred while downloading the file
- Save Failed. When an error occurred while saving the file
- Directory Creation Failed. When an error occurred while creating the folder to save the file