Bank loader for webgl platform

Hey guys,

I am working on a game using FMOD and Unity. This game will be released for Desktop (Win) and WebGL. In FMOD Studio I already setup the two different platforms with seperat adjustments. When I built the soundbanks in FMOD Studio I got the two folders with the soundbank in the /Build directory “Desktop” (30mb) and “Mobile” (8mb). So far so good.

When creating a windows build in Unity everything is fine. FMOD copies the soundbank from the “/Desktop” directory to the “Assets/StreamingAssets” directory. When switching to WebGL, the first thing I noticed is that FMODUnity.EventManager also copies the bank from the “/Desktop” directory. When creating the build for WebGL, i have a StreamingAssets folder with the 30mb soundbank that is intended for the desktop platform only.

It seams that FMOD ignores the mobile platform for the build, even when I select “mobile” for each bank platform in the FMODStudioSettings. I guess I can manually change the files in the streaming assets, but I don’t think this is the right approach.

Is there a way to fix this?
FMOD: 2.00.10
Unity: 2019.4.10f1

Thank you in advance.

Edit: Additional information: I only use the master bank. No error messages occurred during the workflow.

When you have more than one platform target in Studio, you need to configure each platform in Unity also, check out our user guide for the “using a multi platform build” section.

Thanks for the reply. I already did the configuration in Unity and switched to “Multiple Platform Build” in the FMODStudioSettings. Here a screeshot:

And here the bankloader message in the unity console:

FMOD Studio: copy banks for platform WebGL : copying banks from FMOD/project_name/Build/Desktop to D:/Audio/work/project_name/Unity/Assets/StreamingAssets succeeded

as you can see, fmod recognizes the WebGL platform, but he still copies the files from the “Desktop” directory.

My suspicion is that fmod interprets the WebGL platform as desktop platform.

Can’t you switch the Bank Platform for Desktop and see if copies your “Mobile” banks? That would solve your problem.

I have also tried several options. When I switched to the desktop platform in Unity, everything worked fine. I can also switch to “mobile” for desktop platform, and he will copy the mobile banks. But because of the desktop platform this is useless.
When I switch to the WebGL platform in Unity, fmod only copies the “desktop” banks, no matter what settings I use in FMODStudioSettings.

Apologies, I missed the part where you mentioned you are on 2.0, in 2.1 we have a much more advanced system for platform configuration where you can add a WebGL (or any) platform and specify the bank directory directly. For 2.0 WebGL falls back to the default bank directory setting. One work around you could try is changing the default bank platform directory to match your WebGL directory, then override (don’t inherit) the bank platform directory for Desktop, Mobile and any other desired platforms.

When Unity is switched to WebGL I already tried to switch all platforms to “mobile” in the FMODStudioSettings and still FMOD copies the desktop bank.
I guess I have to deal with the workaround, where I have to change manually the soundbank file in the streaming assets directory after the build.
Thanks for your answer anyway.

When you tried switching everything to mobile, did that include “default settings” too? Changing the default should allow it to work for WebGL, then specializing for each other platform should make the remaining platform work without having to manually update after a build.

Yeah, I’ve changed everything to mobile, even in the “Play in Editor” settings. When Unity is switched to the WebGL platform, fmod still copies the desktop banks, as you can see in the log message I posted earlier.