AssetBundleManager: Build with local assetbundles

I’ve been a long time user of the Resources-folder, but I’m trying out the AssetBundleManager, as it has been marketed as somehow an improvement to asset loading.

I’m only using it locally, and my assets will never have to be downloaded from anywhere.

Everything is working fine in the editor in Simulation Mode. And when I hit Build AssetBundles, they build just fine.

But how do I get them into the build?

When building e.g. a Mac Standalone, how do I best get them into the Application-folder that’s created, so I can reference them from the game?

I thought this was automated, when using AssetBundleManager - but it doesn’t seem to work this way…

Any suggestions or pointers are most welcome :slight_smile:

It is natural to think that it should be automatic. But it’s not!

StreamingAssets is the answer you are looking for.

Unity Manual - Streaming Assets

AssetBundleManager does have very LIMITED support of StreamingAssets.

  1. You have to copy AssetBundles your self.

    from AssetBundles/OSX
    to Assets/StreamingAssets/AssetBundles/OSX

  2. Use the following scarcely documented method before Initialize().

    var dir_path = “/” + AssetBundles.Utility.AssetBundlesOutputPath + “/”
    + AssetBundles.Utility.GetPlatformName() + “/”;
    AssetBundles.AssetBundleManager.SetSourceAssetBundleDirectory(dir_path);

  3. You have to care which mode to be used your self.

    for example
    Simulation mode in the Editor
    StreamingAssets mode otherwise
    or
    Debug StreamingAssets mode in the Editor

  4. Multiplatform support is a pain.

    Think of it when you have both
    StreamingAssets/AssetBundles/iOS
    and
    StreamingAssets/AssetBundles/Android
    The truth is, AssetBundle is intended to be used with content distribution server of some sort.

Edit as of June-20th-2016:
I gave it a try myself to confirm my own words and , to my surprise,
I found out SetSourceAssetBundleDirectory() has been broken on iOS platforms.

Actual cause is GetStreamingAssetsPath() in AssetBundleManager.cs .

This is a quick workaround, which supports iOS and Android (and Standalone and Editor).

-         else if (Application.isMobilePlatform || Application.isConsolePlatform)
+         else if (Application.platform == RuntimePlatform.Android)
              return Application.streamingAssetsPath;

But why is it not using UNITY_IOS , UNITY_ANDROID and stuff?