Asset Bundles for Unity

Now let’s take a look at how we can go about creating asset bundles for our app. These are great for bundling up platform specific non-code assets like models, textures, prefabs, audio clips, etc, to dynamically load them into your application. What can be done is you could, for instance, create a 10mb app and then through the use of asset bundles, have the asset bundles download the rest of the app.
First, let’s create a quick script that will all us to create the asset bundles for what we want to bundle up:

Once we have built this script, we can now go ahead and create asset bundles within our editor:

Now we can go back to AWS and create a new bucket for this app and start adding in the new bundle:

When we go to add the bundle that we have created, we want to make sure that we are selecting the File and not the manifest. Once we have uploaded our file, we can take a look at the files within the S3 console:

Now that we have this in place, let’s go back to Unity and start building in our AWSManager again. We will follow the guidelines that are provided to us from Amazon:

Now that we have created the core aspects of our AWSManager, let’s take a look at how we can go about downloading the asset bundle that we created so that we can make use of it:

With this, we are able to now delete the horse object from our hierarchy and whenever we start up our game, the horse object will show up as a child object to our target image:

As we can see, the moment the game starts, our horse objects becomes a child of the ImageTarget.
There we have it. We have successfully created an asset bundle and added it into our game.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store