SaveSystem.DownloadFileAsync
Declaration#
public void DownloadFileAsync(string url, string filename, Action<float> onProgress, Action onComplete, Nullable<DateTime> setTimestamp)Parameters#
| Name | Description |
|---|---|
| url | URL of file to download |
| filename | Full path to save location |
| onProgress | Action to raise on progress update |
| onComplete | Action to raise on download complete |
| setTimestamp | Date/Time to set on file |
Description#
Download a file to disk (async)
Usage#
Example
using NullSave.GDTK;using System;using System.IO;using UnityEngine;
public class CodeSample : MonoBehaviour{
public void ExampleMethod() { // You can use the system to download a file // This is helpful for cloud storage // You can specify actions to inform you of progress and completion SaveSystem.instance.DownloadFileAsync("https://nullsave.com/assets/img/favicon.ico", Path.Combine(Application.persistentDataPath, "favicon.ico"), ProgressUpdate, DownloadComplete, DateTime.Now); }
private void ProgressUpdate(float percent) { Debug.Log("Download progress: " + percent); }
private void DownloadComplete() { Debug.Log("Download complete"); }
}