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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Cannot Load AssetBundle Manifest File

Discussion in 'Scripting' started by lavz24, Jun 2, 2015.

  1. lavz24

    lavz24

    Joined:
    Mar 14, 2013
    Posts:
    45
    HI,

    I try to download and generate a AssetBundleManifest, but when I download it the WWW class doesnt fill the assetbundle field instead it fill www.text with the .manifest file I download.


    Code (CSharp):
    1. using(WWW www = new WWW(manifelURL))
    2. {
    3.  yield return www;
    4.  if(!string.IsNullOrEmpty(www.error))
    5.  {
    6.    Debug.LogError(www.error);
    7.    yieldbreak;
    8.   }
    9.    //www.assetBundle is null but www.text contains the .manifest
    10.      manifest = (AssetBundleManifest)www.assetBundle.LoadAsset("AssetBundleManifest",typeof(AssetBundleManifest));
    11.  yield return null;
    12.  www.assetBundle.Unload(false);
    13. }
     
  2. sotec

    sotec

    Joined:
    Sep 14, 2012
    Posts:
    34
    same problem here Y_Y

    EDIT :
    problem solved : it's not unity which bug but IIS which has a bad config .
    if you haven't add an extension ( .unity3d / .assetBundle, etc) you need to add in IIS the type mime which follow :
    - '.' and (application/octet-stream)

    the file manifest you want for the bundle isn't the .manifest but the other one with the same name
     
    Last edited: Jun 12, 2015
    guneyozsan likes this.
  3. lavz24

    lavz24

    Joined:
    Mar 14, 2013
    Posts:
    45
    I have my assetbundle with the proper extension (.unity3d) and then I have the .manifest text file. Both are in separate folders on some server.
    I want to download first the .manifest to check the hash and then download the .unity3d only if I need it. But when I try to download the .manifest, Unity saves it to www.text instead of loading to www.assetBundle.
     
  4. sotec

    sotec

    Joined:
    Sep 14, 2012
    Posts:
    34
    @lavz24 you want to to something like :

    /// <summary>
    /// Loads the manifest. and fill bundlesNames with every assetbundle of the project
    /// </summary>
    public IEnumerator LoadManifest ()
    {
    Debug.Log( "Loading Manifest");
    using (WWW www = new WWW(pathToBundles + platform ))
    {
    yield return www;
    if(!string.IsNullOrEmpty(www.error))
    {
    Debug.Log(www.error);
    yield break;
    }

    manifest = (AssetBundleManifest)www.assetBundle.LoadAsset("AssetBundleManifest", typeof(AssetBundleManifest));
    yield return null;
    // Unload the AssetBundles compressed contents to conserve memory
    www.assetBundle.Unload(false);
    // Frees the memory from the web stream
    www.Dispose();
    }

    if (!isReady)
    Debug.Log ("There was an error loading manifest");
    else{
    //fill bundlesNames
    bundlesNames.AddRange(manifest.GetAllAssetBundles());


    then , like i said, you don't want to load PC.manifest , but the PC.unity3d , which contain (as an AssetBundleManifest) the information ( hash , url , etc ) of all your other bundles.
     
  5. zzajac

    zzajac

    Joined:
    Feb 20, 2015
    Posts:
    22
    Do you know why on Android/iPhone every time AssetBundleManifest.GetAssetBundleHash(bundleName) return different hash for the same bundle?
     
  6. Pavlko

    Pavlko

    Joined:
    Dec 23, 2012
    Posts:
    9
    Hey.. and what if I want to use the .manifest text file instead of the AssetBundle file ?

    I do prefer to work with the .manifest file so I can append one more asset bundle to the system easily, without having to build all of the asset bundles...