相关疑难解决方法(0)

使用WebClient在Unity3d中下载大文件

我正在寻找有关使用WebClient在Unity3d中下载大型(100mg +)文件的任何想法.WWW以异步方式运行并且完美无缺,除非它返回内存错误并导致应用程序崩溃,因此我已按照此处所述移至解决方案:

如何从网址下载文件并使用C sharp中的unity3d保存在位置?

这就像一个梦想,除了它关闭我的应用程序中的所有脚本,直到下载完成.我似乎无法在下载进行的同时运行加载栏.我已经尝试通过添加协程来处理下载,但到目前为止,没有运气.

任何帮助,将不胜感激.我的代码目前(经过多次迭代)看起来像:

C#

 void Update()
    {
    //Sets up the timer so I can use it to watch the debugging
        timer += Time.deltaTime;
        Debug.Log (timer);

//Checks to see if the file was already downloaded and saved.  If not, it begins downloading.
    if (FileExists == 0 && timer >= 5) {
        StartCoroutine ("DOWNLOAD");

    } 
//If the file already exists, it jumps straight to the next scene.
    else if (FileExists == 1) {
        Application.LoadLevelAsync ("Different_Level");
    }

    //These …
Run Code Online (Sandbox Code Playgroud)

c# asynchronous webclient download unity-game-engine

4
推荐指数
1
解决办法
1万
查看次数