I’m trying to integrate FMOD to our Unity project. Since we need to run on mobile and we want to offer potentially unlimited contents, we are trying to download all the assets the player will need for the current level only.
To do so, I need to be able to download the banks and load them while the app is running.
Following the tutorials on how to play sounds on Unity from FMOD I was able to understand the logic of Events etc, but since I don’t have all the banks at app launch, I cannot rely on the option “Load All Event Data at Initialization”, and as Import Type I’ve selected Asset Bundle.
If I’m letting the FMOD integratio loads the Event data from the StreamingAssets, everything works fine and I can play all the events I want, but as soon as I removed the check from load all event data, I wasn’t able anymore to even load a single bank and play a single sound.
This is what I’m trying to do to load a bank:
studioSystem = FMODUnity.RuntimeManager.StudioSystem; FMOD.Studio.CPU_USAGE cpuUsage; studioSystem.getCPUUsage(out cpuUsage); FMOD.Studio.System bankload; FMOD.Studio.System.create(out bankload); var loadingResult = bankload.loadBankFile(System.IO.Path.Combine(Application.streamingAssetsPath, bankName), FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank); loadedBank.loadSampleData();
But doing that will result in a FMOD.RESULT err_invalid_handle.
I’ve also tried to not create a new bank and use the RuntimeManager to load a bank:
But again, no luck and no error messages, beside the fact that sometime after loading the bank I get an exception:
“BusNotFoundException: FMOD Studio bus not found ‘bus:/’
FMODUnity.RuntimeManager.GetBus (System.String path) (at Assets/Plugins/FMOD/RuntimeManager.cs:825) etc…”
And in all cases, if I try to PlayOneShot one of my events just after loading the bank, I get another error saying the event cannot be found.
Is there a tutorial or somebody who can tell me the proper procedure to load banks as Asset Bundle on run time?
Thank you for your assistance!