We are making a game for mobile (iOS and Android) and are trying to reduce our build size by using Asset Bundles in Unity. Audio files take up a lot of space and might also be updated after the game has launched, so ideally we would like to store them in Asset Bundles as well.

This leads me to my questions:
How do I use FMOD with Asset Bundles? Is it possible at all, has anybody got this to work? I can pack the banks into an Asset Bundle and download that, but I’m not sure what is necessary to make them accessible inside the game then.

If FMOD does not work with Asset Bundles, is there any way we can download and use FMOD files during gameplay? Apparently, all the banks need to be located in the StreamingAssets folder which can only be edited in Unity Editor, it’s read-only in all builds.
Is there a good reason why they need to be in StreamingAssets, and is there a way around that?

Change the code in EventManager.cs so that CopyToStreamingAssets() doesn’t copy files in StreamingAssets but instead sets them up as a binary TextAsset by changing the extension to .bytes and moving them under somewhere under Assets

turn off the “load all banks at initialization” in FMOD Settings

Implement your assetbundle streaming

When you have your assetbundle use LoadAsset(name) to get the TextAsset object, use the bytes variables to get a byte[] and pass that into loadBankMemory() on the Studio system object FMODUnity.RuntimeManager.StudioSystem

Change the code in EventManager.cs so that CopyToStreamingAssets() doesn’t copy files in StreamingAssets but instead sets them up as a binary TextAsset by changing the extension to .bytes and moving them under somewhere under Assets

turn off the “load all banks at initialization” in FMOD Settings

Implement your assetbundle streaming

When you have your assetbundle use LoadAsset(name) to get the TextAsset object, use the bytes variables to get a byte[] and pass that into loadBankMemory() on the Studio system object FMODUnity.RuntimeManager.StudioSystem

Thanks a lot, Nicholas! This is exactly the kind of information I was looking for.

So I guess there is no real reason that it is normally saved under StreamingAssets, it was merely a convenient choice?

Putting it under StreamingAssets lets us use platform native file IO for speed. Also using in-memory bank loading defeats the purpose of having any stream-from-disk sounds inside your banks. To get streaming you’d have to go assetbundle -> extract bank to temp file system -> pass path to FMOD.Studio.System.loadBankFile().

A future release (1.08.06) will have an option to do step 1 in the FMOD Settings, and a helper method in RuntimeManager for loading from a TextAsset.

I’ve already started implementing the steps described above. Will a future release also address the streaming problem with AssetBundles? It’s not too big of a workaround to extract the data to the file system to then stream it in, it’s just a bit slow and unnecessary.

There’s not really any other solution to streaming from a bank within an asset bundle. The asset bundle file on disk is not readable to us, and jumping back from native to managed code every time we do a block of file IO is not feasible.
If you have a large bank you want to stream, it might be best to bypass asset bundles and just download it straight to the file system and give fmod the path.