Search Unity

Assetbundle loading show Received no data in response in unity 2019.2.9

Discussion in 'Web' started by MFKJ, Nov 16, 2019.

  1. MFKJ

    MFKJ

    Joined:
    May 13, 2015
    Posts:
    264
    Recently I have converted my unity 2019.1.0 project into unity 2019.2.9 and its is webgl project. In the project i am using asset bundle and here is the snippet to load the bundle:
    Code (CSharp):
    1.  IEnumerator DependancyAssetBundleLoader()
    2.         {
    3.  
    4.             www = UnityWebRequestAssetBundle.GetAssetBundle(bundleURLForDependency);
    5.            // www.chunkedTransfer = false;
    6.  
    7.             yield return www.SendWebRequest();
    8.             AssetBundle bundleDependancy = ((DownloadHandlerAssetBundle)www.downloadHandler).assetBundle;
    9.  
    10.             if (www.error != null)
    11.             {
    12.  
    13.                 //Debug.LogError("assetBundleURL : " + bundleURLForDependency);
    14.                 Debug.LogError("response code : " + www.responseCode);
    15.              
    16.                 Debug.LogError("www error : " + www.error);
    17.                 www.Dispose();
    18.                 www = null;
    19.                 yield break;
    20.  
    21.             }
    22.         }


    I don't know what went wrong with the asset bundle loading and now i am getting this error:

    > Received no data in response

    I logged the response code and it 0.
     
  2. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    598
    @MFKJ
    Can you try :

    Code (CSharp):
    1.  IEnumerator DependancyAssetBundleLoader()
    2.         {
    3.             www = UnityWebRequestAssetBundle.GetAssetBundle(bundleURLForDependency);
    4.             www.SendWebRequest();
    5.  
    6.             while (!www.isDone)
    7.             {
    8.                 yield return null;
    9.  
    10.             }
    11.  
    12.             AssetBundle bundleDependancy= DownloadHandlerAssetBundle.GetContent(www);
    13.  
    14.             if (www.error != null)
    15.             {
    16.                 //Debug.LogError("assetBundleURL : " + bundleURLForDependency);
    17.                 Debug.LogError("response code : " + www.responseCode);
    18.            
    19.                 Debug.LogError("www error : " + www.error);
    20.                 www.Dispose();
    21.                 www = null;
    22.                 yield break;
    23.             }
    24.         }
     
    Last edited: Nov 16, 2019
  3. MFKJ

    MFKJ

    Joined:
    May 13, 2015
    Posts:
    264
    I tried it and it producing an error:
    InvalidOperationException: Received no data in response
    in this line
    Code (CSharp):
    1.  AssetBundle bundleDependancy = (DownloadHandlerAssetBundle.GetContent(www));
     
  4. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    598
    Are you sure that your url bundleURLForDependency is working properly?
     
  5. MFKJ

    MFKJ

    Joined:
    May 13, 2015
    Posts:
    264
    Yes, indeed when i am putting this url in browser, my gets download.
     
  6. MFKJ

    MFKJ

    Joined:
    May 13, 2015
    Posts:
    264
    Maybe i have a plugin xmlhttpReqeust inside asset and outside asset folder that creating problem? But i delete inner plugin folder still the same problem