Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Exception: WWW download:Unknown Error

Discussion in 'Asset Bundles' started by roseportalgames, Nov 24, 2018.

  1. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    71
    I'm getting this error when using WWW.LoadFromCacheOrDownload: on Android

    Code (CSharp):
    1. Exception: WWW download:Unknown Error
    This is the code:

    Code (CSharp):
    1. // Download an AssetBundle
    2.     public static IEnumerator downloadAssetBundle(string url, int version)
    3.     {
    4.         Debug.Log("We are now going to download... " + url);
    5.         Global.Instance.downloadPercentage = 0f;
    6.         AssetBundleProgressBar.Instance.Begin();
    7.  
    8.         string keyName = url + version.ToString();
    9.         if (dictAssetBundleRefs.ContainsKey(keyName))
    10.             yield return null;
    11.         else
    12.         {
    13.             while (!Caching.ready)
    14.                 yield return null;
    15.             Debug.Log(url);
    16.             using (WWW www = WWW.LoadFromCacheOrDownload(url, version))
    17.             {
    18.                 // Added code for progress bar
    19.                 while (!www.isDone)
    20.                 {
    21.                     Global.Instance.downloadPercentage = Mathf.Clamp01(www.progress / 0.9f);
    22.                     // Debug.Log(www.progress);
    23.                     yield return null;
    24.                 }
    25.                 AssetBundleProgressBar.Instance.End();
    26.  
    27.                 yield return www;
    28.                 if (www.error != null)
    29.                     throw new Exception("WWW download:" + www.error);
    30.                 AssetBundleRef abRef = new AssetBundleRef(url, version);
    31.                 abRef.assetBundle = www.assetBundle;
    32.                 dictAssetBundleRefs.Add(keyName, abRef);
    33.             }
    34.         }
    35.     }
    It's downloading from here:

    http://www.roseportalgames.com/files/assetbundles/Android/duplicates

    I didn't have this problem before updating my game with some new content so I'm a bit confused.

    Thanks,
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    1,921
    Check the headers. If you got STATUS: 200 OK, it means the bundle was successfully downloaded, but it could not be loaded. I'm not sure if you get this status if bundle is in cache though, but in that case the header list should be empty, since there was no actual download.