Search Unity

Bundle not founded (404)

Discussion in 'Scripting' started by RoMax92, Sep 22, 2017.

  1. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    Hi, i'm new in assets bundles, i have a 404 error downloading my bundle and i dont know why.

    I use this Unity tool for create my bundle (a prefab with a 3D file and relative materials), and it come out in 4 different files:
    • bunle
    • bundle.manifest
    • StandaloneWindows
    • StandaloneWindows.manifest
    I load it all on my website, but when i try to download the bundle i have an error (404 Not Found)
    Bundle Link: http://www.maxromagnoli.com/Games/ArtMapp/Bundle

    Script to download the bundle:
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class CachingLoadExample : MonoBehaviour
    6. {
    7.     public string bundleURL;
    8.     public string assetName;
    9.     public int version;
    10.  
    11.     void Start()
    12.     {
    13.         StartCoroutine(DownloadAndCache());
    14.     }
    15.  
    16.     IEnumerator DownloadAndCache()
    17.     {
    18.         // Wait for the Caching system to be ready
    19.         while (!Caching.ready)
    20.             yield return null;
    21.  
    22.         // Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
    23.         using (WWW www = WWW.LoadFromCacheOrDownload(bundleURL, version))
    24.         {
    25.             yield return www;
    26.             if (www.error != null)
    27.                 throw new Exception("WWW download had an error: " + www.error);
    28.             AssetBundle bundle = www.assetBundle;
    29.             if (assetName == "")
    30.                 Instantiate(bundle.mainAsset);
    31.             else
    32.                 Instantiate(bundle.LoadAsset(assetName));
    33.             // Unload the AssetBundles compressed contents to conserve memory
    34.             bundle.Unload(false);
    35.  
    36.         } // memory is freed from the web stream (www.Dispose() gets called implicitly)
    37.     }
    38. }
    Anyone can tell me what i'm doing wrong? Thanks
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    Most likely either your bundle url is incorrect or version does not match. Can't tell as there are not seen in the code you posted.
     
  3. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    The bundle url is correct, the version is 1 (the one to be downloaded)
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    When I click the link you provided in your first post, I get 404 in my browser.
     
  5. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    There is a bundle, what do you expect, a website page? :D
     
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    I expect a file. That what you get when you access asset bundle vie browser. A 404 response is a "Not found" error that is the first clue to the problem, i.e. it can be incorrect URL, incorrect HTTP method (GET). Asset bundle is just a binary file, downloading it via WWW is no different from downloading it via web browser.
     
  7. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    Last edited: Sep 25, 2017
  8. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    I think maybe is a server issue, i go to Aruba for change some access parameters on my website, if it work we well see in a moment
     
  9. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    If i upload the bundle in a zip file, Unity can read it as well?
     
  10. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    We have a built in compression feature for asset bundles. You can specify compression when building a bundle.
     
  11. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    I know, but the output is always 4 files
     
  12. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    And i have another problem: if the file has no extension, the server don't give me the authorization to download it, so i need the bundle is .rar or .zip
     
  13. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    Does the server require extension, one of specific extensions or one of specific file formats?
    You can rename your asset bundle file to whatever you want, unity should load it fine as long as file contents are fine.
     
  14. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    How could i know?
     
  15. RoMax92

    RoMax92

    Joined:
    May 29, 2017
    Posts:
    135
    I think, maybe i need some .htacces file?