Esteban Ibarra

Oct 25, 2021

2 min read

Asset Bundles for Unity

Asset Bundles are a great way to get more content into your app, maybe you want to create DLC, or if your app is too big, you can create a smaller base app, and then download bundles for playing content as you go.

To build an asset bundle, we can follow Unitys documentation page. For this example, we’ll just bundle the horse that we already have.

Selecting the horse.fbx, and in the lower right-hand corner, we can create a new AssetBundle by typing in a new name, we’ll call this one “horse”.

To actually build it, we’ll need to use the code snippet given to us in the documentation:

So we create a new folder called “Editor” and create a script inside of it called “CreateAssetBundles”, and copy this code into it.

Next, right click in the project folder and you’ll see “Build AssetBundle” as a menu option. select it and it will look for and bundle all assets that were marked for a bundle. In our case, we marked the horse for a ‘horse’ bundle so it will create that. Note that if you’re working in Linux, you’ll need to have both Linux and Windows modules installed in order for this to work.

After selecting build bundles, give Unity a few minutes to compile your bundle. When its done, it will have created a new folder called AssetBundles with your horse bundle inside.

From this point, you have an asset bundle ready to upload and download to/from a server like Amazon S3. We’ll get into creating the Amazon S3 manager tomorrow, and after that, we’ll get into downloading.