Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

The AssetBundle Manager Tutorial Q&A

Discussion in 'Community Learning & Teaching' started by Adam-Buckner, Sep 11, 2015.

  1. MobileSimDev


    Apr 19, 2016
    I am also experiencing this issue in the editor. It doesn't seem to matter if the materials and shaders are in a asset bundle or not, they just don't load in the editor. I've logged a bug with a sample project demonstrating the issue. You can check it out here.
  2. tswalk


    Jul 27, 2013
    sure would be great to get a demo of how to script assetbundlemanager from command line 'without' having to use the editor....

    I basically need a batch mode example
  3. iseta


    May 5, 2016
    Welp, it doesn't works, no matter how I work around the asset bundles, it just doesn't works. If I delete the Assets, the AssetBundle will stop working, what's the point of having an AssetBundle if you'll always need to have the Assets in the Asset folder? It does nothing to reduce the size of the application, it would be more practical from the programming point of view to just program all scenes and distribute the final application as a whole. Also, the tutorial presents a function called LoadDependencies(), but when I try to use it, this function doesn't exists at all.
  4. SimteractiveDev


    Jul 9, 2014
    I've got a question that hopefully somebody knows the answer to :)

    I'm loading an atlas from an asset bundle into a dictionary upon start-up, as I need quick access to them during runtime (they all need to be memory anyway). I've noticed that in the memory profiler, the sprites are referenced by ManagedStaticReferences.

    Then, during gameplay I load and instantiate prefabs from the Resources folder. These prefabs have references to sprites that are in the atlas in the assent bundle. This is causing the same atlas to be loaded twice. The first time, it is referenced by ManagedStaticReferences, the second time by the instantiated prefabs.

    So, my question is, do prefabs (that reference sprites in the asset bundle) need to be part of the asset bundle also to prevent them from been loaded twice?
  5. adamt


    Apr 1, 2014
    Benzino07, I believe the answer is, "yes."

    Looking at the Assets, Resources, and AssetBundles tutorial (btw, I'd highly recommend people read this to get a much deeper grasp of the concept -- I only recently stumbled upon it), specifically in section 4.5.1 (Asset Duplication) of the 5th chapter (AssetBundle Usage Patterns).

    You might also want to look at the chapter entitled, "The Resources folder." I've only just begun breaking apart my monolithic Resources structure, but my goal is to wipe it out entirely. It looks like that's what Unity would have us do, anyhow.
    SimteractiveDev likes this.
  6. SimteractiveDev


    Jul 9, 2014
    Oh, I don't think I've see that article, thanks for the link, I'll check it out!

    I suspect you are right though, I'm gonna research it more, as I'm using variants I hope that doesn't throw a spanner in the works (such as needing different variants of the prefabs, which I doubt would be a requirement).
  7. mendozaa265


    Aug 6, 2015
    So in the tutorial they make a lot of use of coroutines to get the requests. Is this the only way? I had a bigger project that I'm now trying to adapt to using assetBundles. Objects are instantiated in random places in code using Resources.Load() and I'm trying to find the asset bundle equivalent to that. I've gotten asset bundles working in a prelooader object that I've made so I've figured out most of it but I'm starting to try and do things in a more dynamic way.

    With that I have a couple questions regarding the tutorial:

    1. Once we initialize the assetbundle manifest we shouldn't have to do it again should we? I'm wondering if once i've called initialize() once am I good for the rest of my game to get requests from the AssetBundleManager by calling loadAssetAsync?

    2. My problem with coroutines stems from trying to call loadAssetAsync and seamingly needing a coroutine to do that everytime. They didn't really address this in the tutorial and so I'm wondering if I should just have all these assets loaded before my game starts instead of loading on the fly? I'm still confused as to the official structure that the manager sets us up for.
  8. Boemak


    May 29, 2013
    So how would I go about loading a level that has scripts in it? I have a hub and spoke game that can download extra levels, if you will, as they become available. How would I go about this? Do I need assetbundles? Can I just create a Zip file with the required assets?

    This is not clear in the slightest, and I've been going over quite a lot of documentation the last couple of days. Some pointers on this would be awesome.
  9. gilley033


    Jul 10, 2012
    I haven't tested this but LoadAssetAsync returns a AssetBundleLoadAssetOperation object which at its base is just an IEnumerator object, so you should be able to do the following:

    Code (CSharp):
    1. void Start()
    2. {
    3.     //Only one StartCoroutine call
    4.     StartCoroutine(MasterCoroutine());
    5. }
    7. IEnumerator MasterCoroutine()
    8. {
    9.     //When you need to load an asset do this:
    10.     string assetBundleName = "assetBundleName";
    11.     string assetName = "Asset Name";
    12.     System.Type assetType = typeof(GameObject);//whatever your type is here
    13.     AssetBundleLoadAssetOperation loadOperation = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, assetType);
    15.     while (loadOperation.MoveNext())
    16.         yield return loadOperation.Current;
    17. }
    You still have to create the AssetBundleLoadAssetOperation object, but at least with this you only have one StartCoroutine call which should reduce garbage generation. I use this with coroutines all the time, but have not tested it with Asset Bundle Loading specifically.

    Good luck!
  10. gilley033


    Jul 10, 2012
    Just a note, on my Windows machine I had to use this instead, otherwise it could not resolve the host:

    Code (CSharp):
    1. AssetBundleManager.SetSourceAssetBundleURL("file:///" + Application.streamingAssetsPath + "/");
    Also note that the platform specific folders storing the asset bundles should be directly under the "StreamingAssets" folder, so:


  11. rubeng


    Apr 20, 2013
    Hi, I am still having some problems trying to create variant asset bundles, I get a hash collision error when having files with the same name in different folders.

    I testd on 5.3.5p7 and also the 5.4.0b25 beta and it is still present.

    I created a bug report (813415) and a test case

    this is just a simple test, asset bundle variants that have two files with the same name in different folders and it fails

    Building AssetBundle failed because hash collision was detected in the deterministic id generation.
    Conflict happened between Asset "Assets/Variant1/Folder2/testfile1.txt" and "Assets/Variant1/Folder1/testfile1.txt".
    Failed to finalize AssetBundle!
    Failed to replace file AssetBundles/OSX/assetbundle1.var1

    there is an issue that claims to have this fixed but at least in the latest patch and beta it is still wrong
  12. pain_gwar


    Apr 14, 2013
    @rubeng from what i know the name of the sub folders must be the same.
    In your example must be:



    Then the folders Variant1 and Variant2 must be tagged with respective variants name

    I think that even the number and the names of the files must match otherwise you can get this error
  13. pain_gwar


    Apr 14, 2013
    I have a question too, i have this strange behaviour:

    I set everything to use variants asset bundles and everything works fine in editor.

    Then i build for android and put that in StreamingFolders. And even in this case everything runs smoothly only when the build is not a development build.

    When i set the development build (for profiling) asset bundles cannot be retrieved, and it seems that unity search them in the default development url (the one stored in the Resources/AssetBundleServerURL

    But for what i learned looking at the code, this url must be used only on Editor mode, not on Mobile build.

    Am i right and this is a bug / unwanted behaviour or is this correct ?

    In the second case how can i force to use my custom url (streaming asset in my case) even in development build ?

  14. rubeng


    Apr 20, 2013
    Hi, this is not the issue that I am having, I mean files with the same name withing the variant so




    this will give the error, because the two shadow.png files in the variant have the same name, even though they are in different folders.

  15. pain_gwar


    Apr 14, 2013
    Ah, sorry for the misunderstanding.

    I had a similar issue and the only way was to rename asset files to avoid repeating. This is very annoying but i think AssetBundles variant are design in this way.
  16. clownbaby


    Sep 4, 2013
    I'm having trouble with building AssetBundles that have dependencies, or maybe I'm misunderstanding something. To be clear, I'm using the AssetBundleManager to build and load assets.

    I have a scene that has some prefabs in it. I assigned the scene to an AssetBundle named "scene" and the prefabs to an AssetBundle named "assets". When I build the AssetBundles using the AssetBundleManager, I end up with two AssetBundles as expected. What's weird is that the "scene" AssetBundle is 12.5mb and the "assets" AssetBundle is 12mb. It seems that the "scene" AssetBundle is including all the assets from the "assets" bundle. I would have expected that since "assets" is a dependency of "scene" then those assets would not be included in the bundle.

    I verified this by removing all the prefabs from the scene and rebuilding. After this, the "scene" bundle was 0.5mb, and the "assets" bundle was still 12mb.

    I checked the "scene" manifest file and verified that "assets" is listed as a dependency.

    I also tried assigning the textures, models and materials to the "assets" bundle rather than just the prefabs and got the same result.

    Does anyone have any insight into what I'm missing here?
  17. pain_gwar


    Apr 14, 2013
    I think this behaviour was intended, when you create an asset bundle from a scene it includes every object in it.

    But you can use this scene to load dynamically the other "asset" bundles, in this way you can reduce the "scene" size.

    If the only things that change in your prefabs is the texture or other elements you can consider using the asset bundles "variants" instead.
  18. tswalk


    Jul 27, 2013
    ( I keep coming back to this topic, it's a curiosity of mine to figure this out between projects and down-time)

    still trying to find a comprehensive guide/documentation on low-level API and scripting the creation of assetbundles in batchmode... needed for automated bundle creation.

    I really don't get it, and just need a jump-off point.

    What I do understand, is that I can call batchmode and execute a class/method that I can create which will (at some point) perform the needed operations to generate my bundles and/or variants.

    However, how do I get my assets into the project? Do I need to do this before I call batchmode, or perhaps passing in a data structure that describes how & what I need... then iterating some pre-processing to import the assets for a particular platform?

    I know someone will say, have you tried it yet?.. and no, I've only gone through the 'manager' tutorial. And my brain needs to see some kind of pipeline example.

    I get what they're for, I understand the ideas of bundling, but only from using the editor examples... I want to be able to automate this in batchmode.

    It is probably a lot simplier than what I can imagine it being...

    oh, and btw... still looking for the link to this:

    where it says:

    I guess "that linked below" is what I'm still looking for :p
    Last edited: Sep 2, 2016
  19. ParsaRt


    Jun 30, 2013
    hi everyone

    im getting this error trying to load bundles in localserver or external server :

    windows is not a valid asset bundle ! and what really bothers me is that in no matter what circumstances im in , the assetBundleName is set to Windows and i dont know why ! i checked almost everywhere in the code and couldnt find a reason. can anyone help me with this ?
  20. Woolf


    Dec 4, 2012
    Hi. How can I configure AssetBundleServer for bundles created in StreamingAssets, rather than AssetBundles?
  21. Kilanirax


    Sep 27, 2016
    Hi all,

    I'm having a little trouble grasping the finer details of the dependency resolution.

    In the demo, when we load the cube, it finds the dependent AssetBundle material-bundle and loads it.

    But no where do I see it actually load anything from this bundle, so how is that the material the cube is dependent upon gets loaded?

    I may have missed something but this is a crucial detail and any help would be appreciated.
  22. Akeru


    May 2, 2014
    I've been stuck 4hours at Friday, 8h yesterday and 3h and counting today with Asset Bundles. I'm shattered mentally.

    I know I'm a fool but I don't understand a few things and I really need this.

    I have a big project with more than 100 narrations in audioclips. The project is multi-language and my objective is to make a bundle with every language with those audioclips and download in-game when user choose their language.

    I know how to make bundles. I know to build it in diferents platforms and the variants thing. My problems comes in next step.

    My doubts are these:

    1. How do I upload the bundles in a remote server correctly?

    I made bundles before, multiples scenes were compiled into a single file with ".unity3d" extension and it was pretty easy to me to upload/download/use. But that was long time ago and I see that things changed.

    Now each bundle come with 2 files, the bundle and a ".manifest" which I understand has the information about some bundle things. I use Filezilla and I know that it must to be in binary type for the manifests files. But:

    1.1. Do I need to upload both bundle and ".manifest"?
    1.2. Do I need to upload the "AssetBundles" and "AssetBundles.manifest" too?
    1.3. Do I need to upload them with their platform folder ([adress]/Android/bundle.manfiest)?

    2. How to download them? What files do I need to download?

    I've tried a lot of scripts and read a lot of things but I can't figure out how to download bundles yet.

    One of the scripts that I've tried is this: I tried both examples but I think the one I need is the "Catching" type.

    They ask about "BundleURL" and "AssetName".

    2.1. Is BundleURL the exact url of the file, or is from the content folder?
    2.2. What is the AssetName?
    2.3. I need to download individually each bundle? .manifest and "AssetBundles" too?
    2.4. There are a better way to download bundles?

    And for the moment that's all. Probably I won't know how to use them once downloaded, but for now (and with 15h of madness) upload and downloading them will be more than enough.

    Sorry for being that silly. There's nobody that I hate more than myself right now.

    And so many thanks for your time. Really.
    ph0b0s and ParsaRt like this.
  23. DziDAI


    Dec 6, 2012
    Hi all,

    We have our application in AppStore (with ODR support) and we are working on the update for this app right now.
    We encountered some problems with updating our app on iOS 10.
    Thing is that when we are updating store version of our app (installing new build from TestFlight over older version from the AppStore) it stops working on iOS 10. We found out that it happens in case of following mistake:
    "unable to open archive file: res://iOS" in AssetBundleDownloadFromODROperation in method FinishDownload, when it calls AssetBundle.LoadFromFile

    Main problem is following:
    During application update on iOS 10, application downloads new manifest for bundles (in my case "iOS") , but can't open it.
    On the other hand, if application is installed as new, it works well.

    How we can fix it?

    @Adam-Buckner @Dave-Hampson maybe you can help us?

    P.S.: On iOS9 we do not encounter any of this problems with the same app, everything works fine.
  24. Konjikiexe


    Dec 5, 2012

    Hi everyone
    I was facing the same problems and questions as Akeru posted
    so I will try to help with what I found

    1.1 - no
    1.2 - no
    1.3 - if you'r using different devices, yes, but only the assetbunlde name!

    like, you only need to upload the file with the name of the assetbundle you gave
    you put like "test" on assetbundle, then unity will create 2 files, test and test.manifest, you only will need the "test" file

    this video will help a lot for your answers!

    it's important to watch through like 33 minutes!
    (it's a lot, I know! but it will help with your answers! welll, it helped me!)

    hope it help someone!
  25. Lanslot


    Nov 18, 2016
    i made a program to load big map,so i decided use assetbundle manager
    and because of models is very big,i've split it to some scenes,Then my program will load thoes all
    but there is a problem is each machine all will generate windows file and windows.manifest file
    so what should i do to merge thoes?

    my english is not good,hope you can understand.thx :)
  26. spinteractive


    Dec 19, 2015
    I'm getting the following error running the demo trying to build AssetBundle with HoloLens Paltform.

    ArgumentNullException: Argument cannot be null.
    Parameter name: path2
    System.IO.Path.Combine (System.String path1, System.String path2) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Path.cs:115)
    AssetBundles.BuildScript.BuildAssetBundles () (at Assets/AssetBundleManager/Editor/BuildScript.cs:19)
    AssetBundles.AssetBundlesMenuItems.BuildAssetBundles () (at Assets/AssetBundleManager/Editor/AssetbundlesMenuItems.cs:27)
    Last edited: Dec 7, 2016
  27. jtkerste


    Dec 28, 2016
    I have also been trying to get the sample project running on an iPad and am getting the same error. Did you ever find the solution to this issue?
  28. brocas


    Aug 22, 2013
    Hi everyone, I have a question regarding AssetBundles but I don't know if this is related directly with the AssetBundleManager.

    I noticed that UnityWebRequest (UnityEngine.Networking) has a GetAssetBundle() method, so I tried using that as replacement to how the AssetBundle sample loads its assets (instead of going through AssetBundleManager).

    I was able to successfully make it work with the AssetLoader scene but when I tried it on the SceneLoader scene, the scene loads properly but the referenced textures were missing. I'm thinking it's because I don't read the AssetBundleManifests that was generated by the AssetBundles > Build AssetBundles option that this happened.

    My questions are:

    1) Is there a way to make UnityWebRequest work in loading scene assets along with the referenced materials of the objects inside it?
    2) How necessary are the AssetBundleManifests when it comes to loading AssetBundles and is there a way to parse them using UnityWebRequest?

    Here's the edited LoadScenes.cs for your reference.

    Code (CSharp):
    2. #define TEST
    3. using UnityEngine;
    4. using System.Collections;
    5. using AssetBundles;
    6. using UnityEngine.SceneManagement;
    7. using UnityEngine.Networking;
    10. public class LoadScenes : MonoBehaviour
    11. {
    12.     public string sceneAssetBundle;
    13.     public string sceneName;
    15.     #if TEST
    16.     IEnumerator Start()
    17.     {
    18.         string url = "file://" + Application.persistentDataPath + "/" + AssetBundles.Utility.GetPlatformName() + "/" + sceneAssetBundle ;
    20.         UnityWebRequest www = UnityWebRequest.GetAssetBundle( url ) ;
    22.         www.Send();
    24.         while(!www.isDone)
    25.         {
    26.             yield return null ;
    27.         }
    29.         AssetBundle assetBundle = DownloadHandlerAssetBundle.GetContent(www) ;
    32.         string[] assetNames = assetBundle.GetAllAssetNames() ;
    33.         string[] sceneNames = assetBundle.GetAllScenePaths() ;
    36.         foreach( string s in assetNames )
    37.         {
    38.             Debug.Log( "assetName: " + s ) ;
    39.         }
    41.         foreach( string s in sceneNames )
    42.         {
    43.             Debug.Log( "sceneNames: " + s ) ;
    44.         }
    46.         SceneManager.LoadSceneAsync( sceneNames[0] , LoadSceneMode.Additive ) ;
    47.     }
    48.     #else
    49.     // Use this for initialization
    50.     IEnumerator Start ()
    51.     {
    52.         yield return StartCoroutine(Initialize() );
    54.         // Load level.
    55.         yield return StartCoroutine(InitializeLevelAsync (sceneName, true) );
    56.     }
    57.     #endif
    59.     // Initialize the downloading url and AssetBundleManifest object.
    60.     protected IEnumerator Initialize()
    61.     {
    62.         // Don't destroy this gameObject as we depend on it to run the loading script.
    63.         DontDestroyOnLoad(gameObject);
    65.         // With this code, when in-editor or using a development builds: Always use the AssetBundle Server
    66.         // (This is very dependent on the production workflow of the project.
    67.         //     Another approach would be to make this configurable in the standalone player.)
    69.         AssetBundleManager.SetDevelopmentAssetBundleServer ();
    70.         #else
    71.         // Use the following code if AssetBundles are embedded in the project for example via StreamingAssets folder etc:
    72.         AssetBundleManager.SetSourceAssetBundleURL(Application.dataPath + "/");
    73.         // Or customize the URL based on your deployment or configuration
    74.         //AssetBundleManager.SetSourceAssetBundleURL("http://www.MyWebsite/MyAssetBundles");
    75.         #endif
    77.         // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
    78.         var request = AssetBundleManager.Initialize();
    80.         if (request != null)
    81.             yield return StartCoroutine(request);
    82.     }
    84.     protected IEnumerator InitializeLevelAsync (string levelName, bool isAdditive)
    85.     {
    86.         // This is simply to get the elapsed time for this phase of AssetLoading.
    87.         float startTime = Time.realtimeSinceStartup;
    89.         // Load level from assetBundle.
    90.         AssetBundleLoadOperation request = AssetBundleManager.LoadLevelAsync(sceneAssetBundle, levelName, isAdditive);
    91.         if (request == null)
    92.             yield break;
    93.         yield return StartCoroutine(request);
    95.         // Calculate and display the elapsed time.
    96.         float elapsedTime = Time.realtimeSinceStartup - startTime;
    97.         Debug.Log("Finished loading scene " + levelName + " in " + elapsedTime + " seconds" );
    98.     }
    99. }
  29. ina


    Nov 15, 2010
    Trying out the default LoadAssets.cs scene with a prefab from the asset store... it looks like when loaded from WWW remote server rather than using the simulator or local drag-and-drop, the resolution looks very different?

    Left is from WWW, and right is just drag and drop from local file system prefab (or also using simulator)

  30. votagus


    Dec 13, 2016
    Hi, I was looking at the API of the Asset Bundle Manager and I couldn'd find a method to load an asset bundle without having to specify an asset name, something like LoadAssetBundleAsync(). I need this because of the way the project works, some asset bundles have to be loaded before showing the menu.
    There is a method to get a loaded asset bundle but seems like the only way to load one is by calling LoadAssetAsync(), and I could just use that one and put some random asset as the name parameter only to get the asset bundle loaded, but I want to know, is there a reason for why that method doesn't exist?

    TLDR; Why the Asset Bundle Manager doesn't have a method to load an asset bundle alone? Like LoadAssetBundleAsync().
    Last edited: Apr 12, 2017
    twobob likes this.
  31. AroraAnkush


    Apr 28, 2017
    Hello all,

    I am working on one of the Strategy based Game Project in which i put all my assets on server as asset bundle. The format i put my Assets on server is .unity. There are number of URL's on which assets are placed as i divided the assets into parts. Everything working fine in my Project. When i need i am able to download the asset bundle from server easily but with my Project the Problem is i can download the assets only when i am downloading the assets using some WIFI network but asset bundle not able to downloaded when my iPhone is on 3G or 4G cellular network. Help me with some good solution. I am not able to understand what kind of situation is this.....?????

    Ankush Arora.
  32. JairoGLoz


    Mar 9, 2017
    Hi all, when I try to start the Local AssetBundle Server I got this error:


    Any ideas on how to fix it?
  33. Reichert


    Unity Technologies

    Jun 20, 2014
    Because you are bypassing the Asset Bundle Manager, you have to also load any bundles that the scene bundle depends on before loading the scene bundle and scene (the ABM handles this for you). The manifest contains all of the bundle dependency information.
  34. Reichert


    Unity Technologies

    Jun 20, 2014
    You typically don't need to do this when using the ABM because it handles loading all of the necessary bundle dependencies for you - just load the asset you need when you need it, and the bundles will be loaded correctly.

    If you really want to load a single bundle without assets, take a look at the
    AssetBundleDownloadFromWebOperation, which can be used as a coroutine.
  35. theBundleDude


    May 11, 2017
    I'm a bit confused with the BuildScript when on iOS. I'm using Unity 5.6 and it seems that regardless of what 'Player Settings' I have 'ENABLE_IOS_APP_SLICING' always seems to be true, and thus my asset bundles always get build Uncompressed.

    Maybe this is a stupid question, but what if I just want to build my bundles compressed and serve them from my own server rather than via the AppStore?

    (I cant actually find what it is that sets 'ENABLE_IOS_APP_SLICING'- if there was a check box for it [as seems to be the case judging by the comments in the code] there doesn't seem to be any more)
  36. userexperiencesg


    May 23, 2017
    As you rightly mentioned, add the trailing slash AFTER AssetBundles.
  37. menghui0330


    Jan 12, 2016
    Hi Reichert, I'm new to asset bundle and I'm currently facing the same problem using ABM as well. The reason why I want to do this is to make sure every assetbundles are downloaded or up-to-date at some kind of assets downloading or management scene right after I start my game, so that I don't have to download assetbundles in the middle of the game when loading assets from bundle. So do you recommend using ABM for this kind of use case? Or are there any better solutions for this?
  38. sgower


    Mar 9, 2015
    I really like the "Simulation Mode" which lets you test Asset Bundle content changes without rebuilding the bundles each time. But the thing I don't like is that the Asset Bundle Manager only seems to support asynchronous loading of assets (via LoadAssetAsync). Is there a way to load assets using the Asset Bundle Manager synchronously?

    My problem is that if I call LoadAssetAsync 500 times in a loop, because the method returns an IEnumerator, I need to call it with a yield each time (ie "yield return LoadAssetAsync"). Each time I yield, it waits until the next frame is returned, and the process is really slow. Id prefer to load all 500 assets without yielding at all. The screen goes dark while this loading happens, but this is preferable because it completes much more (maybe 10 times?) more quickly.

    I've used Coroutines/IEuerables a fair amount, but still find them tricky. I'm sure there must be a way to accomplish what I'm trying to do, but I'm a bit stumped.
  39. Reichert


    Unity Technologies

    Jun 20, 2014
    Can you describe in a bit more detail the context for why you are loading hundreds of assets via script like this? Just want to make sure I understand your use case a bit more.
  40. sgower


    Mar 9, 2015
    Hi, Reichert, my game is a VR world builder/physics sandbox type game. And the scenario where I may load hundreds of prefabs is when saved games are loaded. If I only load 1 object per frame, the load game takes much longer than if I never yield and load all the objects at once. In Vive VR games, if you don't yield and the operation takes too long, SteamVR sends you into a "Waiting for XXX (application name)" screen which is fine. I'd rather have the user experience 3-5 seconds in the waiting for room, that sit for the 15-20 seconds it takes to load 1 object per frame.

    Is there any way to call the LoadAssetAsync method in a loop, and not yield to the next frame each time?

    I did figure out how to load assets from Bundles non-asynchronously. Like this:
    Code (CSharp):
    1.   LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out m_DownloadingError);
    2.             Debug.Log("loading from bundle and bundle=" + bundle);
    3.             if (bundle != null) {
    4.                 obj = bundle.m_AssetBundle.LoadAsset(assetName, t);
    5.                 Debug.Log("aobj=" + obj);
    6.             }
    7.             return obj;
    But shouldn't the AssetBundleManager class itself have a method that does this? I think there are plenty of scenarios when non-async loading is preferred.
  41. xpkoalz


    May 31, 2014
    Hi Reichert,
    Have studied the tutorial it covers loading assets that is created from a scene or a gameobject...but it didn't cover loading assets from a folder.

    I have a group of sprites which would playback during runtime by using Resource.Load + folder name...the images/ sprites in the resource folder had bulk up my app and I could not put it in Apple Store. So..I'm looking to load the resource externally, perhaps on first installation of the app...hence I'm trying out the AssetBundle tutorial.

    but when I try to load using AssetBundle, it seems to be able to load the bundle, but I am not able to target the specific folders to load the sprites.

    for example:
    mainFolder* (made into bundle) > folderA = sprite1 ~ sprite10
    mainFolder* (made into bundle) > folderB = sprite1 ~ sprite10

    tried loading mainFolder-bundle, using 'LoadAssetAsync'...but how to specified System.Type folder??
    tried loading mainFolder-bundle, using 'LoadLevelAsync'....but couldn't target 'folderA', error message saying 'scene not found'.

    Would really appreciate some guidance here or any suggestions ....have spent one week on this...and I'm stuck.
  42. xpkoalz


    May 31, 2014
    I managed to
    - export a folder of sprites into an assetbundle
    - upload the assetbundle to a server
    - download it in unity
    - but how do I access the sprites and have them playback in a sequence??

    Code (CSharp):
    1.        // Try Load folders
    2.     IEnumerator DownloadAndCache (string variantname)    {
    3.         string bundleURL = "";
    4.         www = new WWW (bundleURL);
    6.         yield return www;
    8.         if (www.error != null) {
    9.             throw new System.Exception ("WWW download had an error:" + www.error);
    10.         }
    12.         AssetBundle bundle = www.assetBundle;
    13.         bundle.LoadAllAssets ();      
    15.         foreach (string name in bundle.GetAllAssetNames()) {
    16.             Debug.Log (name);
    17.         }
    18.     }
    I do get a list of the file names in the folder...
    but what is the name of the method I should use to access the sprite??!?!
    there are .GetAllAssetNames and .GetAllScenePath, which both returns strings...

    Last edited: Jul 3, 2017
  43. Desoxi


    Apr 12, 2015
    Does this manager still work in Unity v2017.1.0f3?
    When trying the variant example from chapter 4 i keep getting the following:

    Code (CSharp):
    1. Failed downloading bundle Windows from
    2. UnityEngine.Debug:LogError(Object)
    3. AssetBundles.AssetBundleLoadAssetOperationFull:IsDone() (at Assets/AssetBundleManager/AssetBundleLoadOperation.cs:190)
    4. AssetBundles.AssetBundleLoadOperation:MoveNext() (at Assets/AssetBundleManager/AssetBundleLoadOperation.cs:17)
    5. UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
  44. Desoxi


    Apr 12, 2015
    Okay, so i tried this "Xampp" approach as a few of you guys already did, copying the assetbundles into xampp/htdocs folder and then updating the "AssetBundleServerUrl" file under AssetBundleManager/Resources with localhost url.
    I can access the folder per web browser and entering it manually, but the abm again has the same error as above (different url ofc).
    One thing i notices is the following:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. AssetBundles.AssetBundleManager.RemapVariantName (System.String assetBundleName) (at Assets/AssetBundleManager/AssetBundleManager.cs:251)
    3. AssetBundles.AssetBundleManager.LoadAssetAsync (System.String assetBundleName, System.String assetName, System.Type type) (at Assets/AssetBundleManager/AssetBundleManager.cs:471)
    4. LoadAssets+<InstantiateGameObjectAsync>c__Iterator2.MoveNext () (at Assets/AssetBundleSample/Scripts/LoadAssets.cs:51)
    5. UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    6. UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    7. <Start>c__Iterator0:MoveNext() (at Assets/AssetBundleSample/Scripts/LoadAssets.cs:18)
    8. UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    Which is telling that the m_AssetBundleManifest used in
    Code (CSharp):
    1. static protected string RemapVariantName(string assetBundleName)
    2.         {
    3.             string[] bundlesWithVariant = m_AssetBundleManifest.GetAllAssetBundlesWithVariant();
    5. ..
    6. }
    is still null when trying to access and after debugging it stops exactly there. What might be the reason for this?
    ph0b0s likes this.
  45. ph0b0s


    Dec 18, 2013
    I´m stuck with the same problem and nothing seems to work. It´s really frustrating to work with assetbundles in Unity. Watching the Unite 2017 presentations there was one about the ResourcesManager that should be the new assetbundle pipeline and they said that would comes with 2017.1. Nothing with that release, nothing in the Roadmap and all the project files, the examples and the high level utility called AssetBundle Manager, just dont work in Unity 2017.1 with Windows 10. I´ve lost like a week of work just trying to make this work properly and not only the lack of proper "actualized" documentation, totally zero descriptive error to follow in order to fix anything.
  46. ph0b0s


    Dec 18, 2013
    Try to change this (403) line in the assetbundlesManager:
    // If downloading fails.
    //if (download.error != null)
    if (!string.IsNullOrEmpty(download.error))

    Checking the WWW class documentation it says that in some platforms the .error string could be empty because the platform dont allow null in strings. That fix all this mess, and there went one week of my work.
  47. Desoxi


    Apr 12, 2015
    @ph0b0s Thanks for your work... i had to stop on this because of other things which had to be completed and i realized that solving this problem would take a bit longer than 1-2 days. Gonna try this out as soon as possible :)
  48. Skylabs


    Aug 25, 2017
    @ph0b0s Thank you for this fix !

    This solution is working well with a wamp server. (or xamp). But when trying with an external server with a URL, it give this error " Failed downloading bundle Windows from https://***/assetBundle/Windows/Windows: 403 Forbidden ". It seems that it is an error from the 2017 version because with the 5.6 version it's working well.

    Do you have any idea of how to fix it ? :)
  49. yourstoryinteractive


    Mar 27, 2017
    Hey guys, who has problems with the asset bundle manager when there are network connection issues? Just turn off the network adapter before loading an asset bundle and the asset bundle manager will never be able to resume downloading after that...

    Anyone has a solution?
  50. fugogugo


    Jun 18, 2013