Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Error while downloading Asset Bundle: Failed to decompress data for the AssetBundle

Discussion in 'Editor & General Support' started by mlawrence2, Jul 9, 2018.

  1. mlawrence2

    mlawrence2

    Joined:
    Apr 17, 2018
    Posts:
    2
    Hello,

    I am working with AssetBundles in 2018.1.6f1 on Mac OS X. I have a set of scripts which are working great for AssetBundles of a particular size, but once they cross a threshold (still establishing what that is), the bundle fails to even download with the following errors:
    Error while downloading Asset Bundle: Failed to decompress data for the AssetBundle <web url location>
    and a second error:
    Unable to write data

    Here is a code snippet:
    Code (CSharp):
    1. UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(downloadPath + Key);
    2.                     //request.timeout = Timeout;
    3.                     request.SendWebRequest();
    4.                     while (!request.isDone)
    5.                     {
    6.                     }
    7.                     if (request.isNetworkError || request.isHttpError)
    8.                     {
    9.                         Debug.LogFormat("Download Editor Bundle failed with: {0}", request.error);
    10.                     }
    11.                     else
    12.                     {
    13.                         bundleToLoad.Bundle = DownloadHandlerAssetBundle.GetContent(request);
    14.                     }
    A bit more background, the bundles are compiled using essentially the Unity provided BuildPipeline code for producing AssetBundles. The Bundles are being uploaded to an Azure storage account's BLOB storage container, and then they are attempting to be downloaded from there.

    These bundles are built for BuildTarget.StandaloneWindows and I am attempting to load them into the Unity Editor sometimes in Edit mode still, sometimes in Play mode.

    I can successfully compile, upload, download and instantiate from a bundle of size 1mb or less. I have a bundle which I have trimmed to 10mb compressed. I can compile and upload this (10mb) bundle, however I am getting those errors when downloading. So somewhere between 1mb and 10mb is a threshold I am crossing. Has anyone experienced something similar or have any solutions for this?
     
    Last edited: Jul 10, 2018
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,637
    Check the value of Content-Length response header - is it identical to the size of your bundle?
    You can also try to download the bundle using DownloadHandlerFile and then compare the resulting file with the original one you've uploaded to server.
     
  3. akhror_unity

    akhror_unity

    Joined:
    Sep 10, 2020
    Posts:
    4
    Unity version of created asset bundles not the same with running Unity editor version.