Hi! You’re probably asking yourself “okay, so I know I want this. How do I put this thing together?” If you haven’t already, you’ll need to understand what an asset bundle is. I described it on the Introduction.


This tool’s job is to make it possible to load a prefab (or most anything else) from an asset bundle with a single request:

var operation = bundleManager.LoadAsset<GameObject>( assetToLoad.bundle, assetToLoad.asset );

That’s truly all there is to it. This will be an asynchronous call. That means the ‘operation’ is an object that you wait for, for example in a coroutine.

yield return operation;

Because things do still go wrong, error handling is required, but simple:

if (operation.Error != null)
    Debug.LogErrorFormat("Unable to load {0}, cannot continue. {1}", assetToLoad, operation.Error);

    // Tell BundleManager we're done with the bundle.
    yield break;

A common thing to do with a prefab is to instantiate it to make it part of your scene:

var template = operation.GetAsset<GameObject>();
var instance = GameObject.Instantiate(template, this.transform, instantiateInWorldSpace:false);

And when we’re done with the instance, we release the bundle. Balancing these loads with unloads are absolutely essential!


That’s all there really is to it! Our loader handles the rest.


Here’s the basic design of the system. What follows it is the “Readme” that is included in the project, which outlines specific steps to building and running with your first set of bundles.

graph TD subgraph Building b1>Project assets] b2(MakeBuildDependencies) b3(BuildBundles) b1---b2 b1-->b3 end
graph TD subgraph Runtime r1>IBundleManifest] i1((Internet)) r3(IManifestLoader) i1-->r1 r3-->i1 r4(BundleManager) r1-->r4 r2a((Bundle 1)) r2b((Bundle 2)) r2c((Bundle 3)) r5>Runtime Assets] r2a-->r5 r2b-->r5 r2c-->r5 end r4-->r2a r4-->r2b r4-->r2c


This is the entire content of the “Readme.md” file that is included in the project.


Thank you for installing the Asset Bundle #9’s BundleManagerPro tools!

So now what? :^)

Getting Started

  1. Open the Scenes folder, SampleScene.
  2. In the menus, turn on Assets->AssetBundles->Simulation Mode. Expect a checkmark when on.
  3. Press Play. Expect a capsule to display in the Game view.

SampleScene contents

Be sure to not be in Playmode to match what we describe here.

  1. In the Hierarchy, select the BundleManager object.
  2. In the Inspector, look at the BundleManager component. This is the main loader that will keep track of everything. In your projects, this object will probably want to exist for the life of your application. Do not unload it when loading new scenes! You can flag it as Object.DontDestroyOnLoad, or embed it in a scene you never unload.
  3. Notice all the settings available there. They are all documented on the support website. Largely you don’t need to mess with them, the default settings are pretty good.
  4. Look at the Inspector for the Prepare Bundle Manager script. This should only need to exist on startup. This object’s job is to load the initial bundle manifest and set it on the BundleManager. The instructions below will describe connecting to a local server. It is this object that will set what URL to load the manifest file from.
  5. In the Hierarchy, select the LoadAnAsset object.
  6. This is an example of how to request an asset from the BundleManager. This is expected to happen over and over again during the course of your game. You could put twenty of these in the scene pointing at various assets and they’ll load as soon as they’re ready.
  7. Notice the ‘Asset to Load’ field looks like it’s linking directly to a prefab in the project. It’s not really! It’s storing only the name of the asset and the bundle that asset is put in. This means that any asset you want to load must be saved on disk, and assigned to a bundle before you can use it in the Asset to Load.

Now this is not the only way to do all this, but this is a way to do it.

So now we’re going to turn off Simulation mode and load some bundles for real.

Building Bundles

To load bundles, we must build the files that will be loaded. This is done the following way:

  1. Be sure we are in the Standalone platform. In Unity3d, menu File->Build Settings. Select the Platform “PC, Mac & Standalone”. If it’s not already set, press Switch Platform.
  2. Close the Build Settings.
  3. Select the menu Assets->Asset Bundles->Build Bundles. Expect it to take some time and show some progress dialogs. With the assets it has now, it should be less than five minutes.
  4. It will put a message in the console log when it’s done.
  5. If you like, you can inspect the files by looking at the project folder, in a folder named “BuiltBundles”.

Serving Bundles

We need to offer those bundles through a webserver of some kind. Any HTTP server will do. In this case we will use python which is preinstalled on OSX. In Terminal:

  1. cd <project folder>/BuiltBundles
  2. python -m SimpleHTTPServer

It should show a message similar to Serving from on port 8000.

You can alter the “Prepare Bundle Manager” script’s “Manifest Base URL” if you need to change the address or port. Remember that it must end with /{0} where we will add the name of the manifest to load.

Loading Bundles

Back to Unity3d.

  1. In the menus, turn off Assets->AssetBundles->Simulation Mode. The checkmark should now be gone.
  2. Press Play. Expect a capsule to display in the Game view.
  3. Profit.

What Next?

From here, importing the Plugins/BundleManagerPro into your project is all you need to begin writing your own scripts, referring to this project’s examples.

Additional documentation is available on the Support website.