Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

'Bad file length' Error while downloading assetbundle file.

Discussion in 'Editor & General Support' started by Zeratul, Jul 9, 2013.

  1. Zeratul

    Zeratul

    Joined:
    May 22, 2013
    Posts:
    5
    I got an error message while downloading assetbundle file.
    Like this: "Bad file length. URL: blahblah"

    This is the download code.
    Code (csharp):
    1.  
    2. WWW www = new WWW(url);
    3. while (www.progress < 1.0f)
    4. {
    5.     fileDownloadProgress = www.progress;
    6.     yield return null;
    7. }
    8. yield return www;
    9. yield return null;
    10.  
    11. if (www.error != null)
    12. {
    13.     Debug.LogError("ERROR while downloading " + keyName + ": " + www.error);
    14.     www.Dispose();
    15.     yield break;
    16. }
    17.  
    But strange thing is that only few files show this error among approx. 600 files. These files are built with same assetbundle build setting and downloaded from same web server. Platform was Android and iPhone, both showed same error.

    Could this happen from what cause? Assetbundle build error? or WWW download error? Corrupt resource file?
    One thing is that after I built assetbundle with no compression it did not happen.

    I attached two resource files and their .meta. These files are original resource files that causes error.
    And their assetbundle file links are here which causes error while www downloading.
    https://dl.dropboxusercontent.com/u/20968541/BadFileLength/Follower_V2_L.assetbundle (for android)
    https://dl.dropboxusercontent.com/u/20968541/BadFileLength/Griffin_V1.assetbundle (for iphone)
    Sorry for the inconvinence for different platform. Both two files cause error on both platforms.
     

    Attached Files:

    Last edited by a moderator: Jul 9, 2013
  2. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
  3. Zeratul

    Zeratul

    Joined:
    May 22, 2013
    Posts:
    5
    That unity version might be different, but it is because android build machine is different from iphone build machine.. Each executable and assetbundle was build in same machine.
    But if version mismatch is the reason of the problem, why only two files make the error? Shouldn't entire file have to cause error?
     
  4. aj17

    aj17

    Joined:
    Nov 9, 2014
    Posts:
    1
    Hi ,
    I am facing with similar problem. I built the asset bundles and uploaded on a server with the same unity version. I get the problem named " Bad File Length " on console window. Kindly help with the matter . I am really struck.
     
  5. Jakhongir

    Jakhongir

    Joined:
    May 12, 2015
    Posts:
    37
    Have this error when downloading asset bundle too. Tried downloading via browser using same link, downloaded without any errors.
     
  6. Jakhongir

    Jakhongir

    Joined:
    May 12, 2015
    Posts:
    37
    deleting caches folder, solved the problem