Skip to main content

SaveSystem.DownloadFileAsync

Declaration#

public void DownloadFileAsync(string url, string filename, Action<float> onProgress, Action onComplete, Nullable<DateTime> setTimestamp)

Parameters#

NameDescription
urlURL of file to download
filenameFull path to save location
onProgressAction to raise on progress update
onCompleteAction to raise on download complete
setTimestampDate/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");    }
}