UnityWebRequest下载文件获取进度
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;

public class Proc : MonoBehaviour {

    UnityWebRequest web;
    
    void Start () {
        StartCoroutine(WebDown());
	}
	
	void Update () {
        if(web != null)
        Debug.Log(web.downloadProgress);
	}

    IEnumerator WebDown()
    {
        web = UnityWebRequest.Get("http://down.sandai.net/thunder9/Thunder9.1.47.1020.exe");
        yield return web.SendWebRequest();
    }
}

以静态方法来获取下载的实例的,UnityWebRequest对网络操作都采取这种方式了


首页 我的博客
粤ICP备17103704号