Include asset bundles in app

Hi,

To reduce the size of the Android and iOS version of our game we’d like to put some resources in a downloadable asset bundle. For test builds and for the PC/Mac version of the game we’d like to include all asset bundles within the app. Is that possible to do?

The solution I see is to make a script that moves all the asset bundle resources into a Resources/ directory with AssetDatabase.MoveAsset. That’s a bit clunky and doing it as a step in a build script will often result in Unity crashing for us. Is there any other way?

Any ideas are appreciated, thanks!

We have our own mechanism for building asset bundles / preparing the game for a build.

This includes a few options such as build all asset bundles, build & copy all to streaming assets, or a build option that mimics how we actually build the game for release (includes a bunch of othe rprocessing that is done to the created asset bundles).

You should have a look at the AssetBundleManager as it provides the code you need to build & copy all bundles to StreamingAssets so they’ll be included in the build.

Also, this is a nice article about asset bundles (and specifically, about the AssetBundleManager):

Thanks liortal, that’s a good idea! I’ll try it out.

One benefit of moving the asset bundles to a Resources directory though, I’ve noticed, is that it’s much faster to build than actually building the asset bundles. If you’re several people testing new builds on Android/iOS devices every day it’s nice to reduce the wait.