1. Home
  2. Docs
  3. Unity SDK
  4. Asset Bundle Management
  5. Preparing the Asset Bundles

Preparing the Asset Bundles

Unity offers an excellent way to create asset bundles. To find out more about about the asset bundle workflow read here.

Tagging the Asset Bundles:

The first step in creating asset bundles is to tag the assets that one wants to upload.
Tagging asset bundles in Unity

With a prefab selected, click the inspector tab. At the bottom (by the preview) you can add it to an asset bundle, or create a new asset bundle.

In the above example the “stone” asset is being added to the bundle “rock”. Making a note of which asset is added to which bundle (case is important!) will make future steps easier.

Creating the Menu Entries:

The next step is to enable the creation of asset bundles for iOS and Android within Unity.

Unity offers an excellent explanation on how to do this here.

For convenience this is a (barely) modified version of the script that targets both iOS and Android. here.

This script can be named anything as long as it has the .cs extension. However, it absolutely must be placed under a folder called Editor in the project.

Building the Bundles:

Once Unity detects this script it will create menu entries under “Assets”
Showing the asset menu in Unity.

Selecting the menu entry to build for will trigger a build. The build will find all assets that have been “tagged” and add them to the corresponding bundles.

Showing the asset bundle build folder in Unity.

Unity places the bundles under /AssetBundles/{PlatformName}.

In the next step we will be uploading this to Motive!

[motive_childposts]

Articles

Was this article helpful to you? Yes No

How can we help?