Unity file WWW(url) not retrieving all bytes

孤街醉人 提交于 2019-12-11 06:35:26

问题


A few moments ago I posted a question because I wasn't able to download a file using WWW() but now I've come to a new problem:

The file that has to be downloaded is ~127mb in size. When I check the file that has been downloaded it shows 55mb. (Which explains why the file isn't able to be opened).

The code I'm using to download the file:

IEnumerator WaitForGame(){

    WWW www = new WWW("https://www.dropbox.com/sh/aayo9iud7t98hgb/AACDqSST_-rT2jIfxq1Zc2SXa?dl=1");
    Debug.Log ("Downloading");
    yield return www;
    byte[] yourBytes = www.bytes;

    System.IO.File.WriteAllBytes(FullPath, yourBytes);
    Debug.Log ("Done downloading!");

}

void UpdateGame(){
    string path = Application.dataPath;
    if (Application.platform == RuntimePlatform.OSXPlayer) {
        path += "/../../";
    }
    else if (Application.platform == RuntimePlatform.WindowsPlayer) {
        path += "/../";
    }

    if (System.IO.File.Exists (path+"/Apo_Alpha.app")) {
        Debug.Log ("File exists!");
        System.IO.File.Delete (path+"/Apo_Alpha.app");

    }

    FullPath = path + "/Apo_Alpha.app";


    StartCoroutine (WaitForGame ());












}

I have no clue to what the problem can be, and it would be great if someone could help me out with this one.

来源:https://stackoverflow.com/questions/42455838/unity-file-wwwurl-not-retrieving-all-bytes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!