Search Unity

Can't download Asset Bundle. "Received no data in response" error despite bundle downloaded 100%

Discussion in 'Web' started by Gulliver, Jan 25, 2019.

  1. Gulliver

    Gulliver

    Joined:
    Jan 8, 2013
    Posts:
    101
    Hi.

    I have several different asset bundles uploaded to the same server that the WebGL game build.
    In the Unity 5.6.5 the game downloads those bundles without any problems.

    With the Unity 2018.3.0f2 I encountered the critical issue. Some of the bundles the game failed to download.
    All bundles were rebuilt with Unity 2018.3.0f2 and have the same structure.

    There is no correlation with the contents or size of the bundle. Some of the big bundles load ok, some of small -- failed.

    I have changed using WWW class for downloading bundles to the UnityWebRequest (
    using( UnityWebRequest www=UnityWebRequestAssetBundle.GetAssetBundle(url.....)). It didn't help.

    The most interesting thing is failure diagnostic. Here it is. You can see UnityWebRequest fields: uploadPorgress, downloadProgress, etc.

    Obviously: the file was downloaded successfully. 335103 -- is correct file size. And downloadProgress==1
    But why does UnityWebRequest.isNetworkError==true ?!
    And what does it mean - error message "Received no data in response" ?!

    P.S. In the Unity Editor ALL bundles download without any issues and work correctly. I have a problem in the WebGL build in browser.

     
  2. UDN_08a62c30-cdb1-4e59-bb48-acda29f9e582

    UDN_08a62c30-cdb1-4e59-bb48-acda29f9e582

    Joined:
    Jun 19, 2018
    Posts:
    23
    In our game we have everything in a separate bundle (300+ bundles for now). Some of bundles had the same problem "Received no data in response". I spent a lot of time to figure it out.
    I didn`t find reason, but solution. Sometimes some combinations of texture with/without alpha cause such problems.
    Solution: change DXT1 to DXT5 for albedo texture.
     
    tim_lol likes this.
  3. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    By any chance do some of your assetbundles share the same name (or does it work when you disable caching on the UnityWebRequest)? Annoyingly Unity's internal asset bundle caching system will fail when trying to cache multiple bundles with the same name even if they are actually different bundles (i.e. you can't cache SomeSite.com/SomePath/Hello.bundle and SomeSite.com/SomeOtherPath/Hello.bundle). At any rate, you don't want to cache on webgl using UnityWebRequests as it will increase memory usage.

    Having said that, we've had random sporadic issues with UnityWebRequest failing for no apparent logical reason (I'm sure there's one somewhere). What we do is give each asset bundle 3 tries to download correctly before aborting. That method has basically solved our "random sporadic issues" with UnityWebRequest. :D
     
    MNNoxMortem likes this.
  4. Gulliver

    Gulliver

    Joined:
    Jan 8, 2013
    Posts:
    101
    No, all our bundles have unique names.
    Some bundles contain only textures, but most of the bundles contain only one .bytes file.
    And about 10% of those bundles failed to load...
     
  5. Gulliver

    Gulliver

    Joined:
    Jan 8, 2013
    Posts:
    101
    Update.
    I tried two new things. First -- I changed call UnityWebRequestAssetBundle.GetAssetBundle() to using Hash128 instead of uint version.
    Code (CSharp):
    1. using( UnityWebRequest www=UnityWebRequestAssetBundle.GetAssetBundle(url,Hash128.Parse(hash),0) ){
    2.             yield return           www.SendWebRequest();
    3. }
    Not helped. Same error. I made some more diagnistic to show you the situation:


    Second thing -- I tried to download asset bundle like simple buffer, with UnityWebRequest.Get() call:
    Code (CSharp):
    1. using (UnityWebRequest www = UnityWebRequest.Get(url)){
    2.             yield return             www.SendWebRequest();
    3. }
    and printed same diagnostic.


    Everything is fine! No "NetworkError".

    THANK YOU, UNITY DEVS. GREAT JOB !
     
    MNNoxMortem likes this.
  6. tmars

    tmars

    Joined:
    Jul 26, 2013
    Posts:
    42
    We've just got the same error on a project rebuilt with 2018.3.4f1. Everything was fine on 2018.3.2f1, no changes in code/data just the new version of Unity. Seems like a bug in Unity.
     
  7. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Sounds like something we should fix. Any chance you could submit a repro on a bug report?
     
  8. Gulliver

    Gulliver

    Joined:
    Jan 8, 2013
    Posts:
    101
  9. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    Yeah I've put it on my todo list (sooner rather than later). By the way, I had to edit the CachedXMLHttpRequest plug-in (https://assetstore.unity.com/packages/essentials/tutorial-projects/cachedxmlhttprequest-71538) to work in Safari when the Unity wasm object is in an iframe and a cross-domain environment (i.e. when access to the site's indexdb is blocked). I basically set a flag in the init function if the indexdb is accessible or not (and then don't try to cache GET requests if it's not accessible).
     
  10. MFKJ

    MFKJ

    Joined:
    May 13, 2015
    Posts:
    264
    My webgl asset bundle loading was working fine until unity 2019.1.0. Recently i upgraded my project to unity 2019.2.9 and start getting Received no data in response. i logged the response code and it is zero. Remember I were previously using WebGLCachedXMLHttpRequest package plugin but now it is available by default so i have removed the plugin. But it is strange why my bundle are not loading despite making new bundle with the same version. You can view the full question here.