Programming/Unity

[UNITY] 유니티에서 Image Download 하기

HyeunJae 2021. 12. 16. 19:00

WebClient 클래스의 DownloadFile 기반 함수를 통해 다운이 받아진다.

첫번 째 인자 : 다운받을 링크 주소

두번 째 인자 : 다운받은 파일을 위치시킬 파일 경로

using System;
using System.Net;

void DownLoadFile(Uri uri, string path, Action<System.ComponentModel.AsyncCompletedEventArgs> onCompleted = null)
    {
        WebClient client = new WebClient();

        client.DownloadFileAsync(uri, path);
        client.DownloadFileCompleted += (s, e) => onCompleted?.Invoke(e);
    }

 

 

정상적으로 다운이 된다,