Various runtime errors after switching to WebGL

I have inherited a project which uses FMOD. I’m a complete noob when it comes to FMOD so am struggling to resolve some errors in my WebGL build.

The game runs great in the editor, with all sound being as intended. It also works in a Windows build.

I switched platform to WebGL and am now receiving a range of errors.

All of these errors disappear (and the game runs fine in WebGL) if I simply uninstall FMOD.

Of course I don’t want to do that, so I’ve installed FMOD and am working to debug these errors.

Currently on startup, in the game’s main menu, I see the following errors. The game doesn’t crash, but all menu functionality is gone. The music plays anyway.

[FMOD] assert : assertion: ‘mRiffChunk.mType == ChunkType_Riff && mRiffChunk.mID == id’ failed

BankLoadException: [FMOD] Could not load bank ‘http://localhost:57671/StreamingAsset/music.strings.bank’ : ERR_FORMAT ; Unsupported file or audio format.

There’s a repeat of the above error, but with sfx.bank. There are then several errors of the type

ArgumentNullException. Value cannot be null.
Parameter name: source

These null exception errors I believe to be due to the dependency injection system (zenject) trying to refer to something in FMOD which has become null in this build.

All of these problems go away if I simply remove the FMOD folder and references to FMOD in my scripts.

The banks are definitely where the FMOD Settings is looking.

Some of these errors I resolved by rolling back my version of FMOD in Unity to the version which was used at the time the banks were created.

However, I now have this error:

BusNotFoundException: [FMOD] Bus not found ‘bus/’

These errors also persist:

ArgumentNullException. Value cannot be null.
Parameter name: source

I can’t seem to designate a bus.

Hi,

It’s likely that your banks aren’t being copied to the build directory properly, potentially due to Zenject, or that your webserver isn’t serving them properly for the build to access. To start I’d recommend checking your WebGL build to ensure that they’re present in the ./StreamingAssets folder and are the correct size, and that your webserver is serving them appropriately.

Otherwise, can I you to provide:

I was able to resolve these errors by creating a loading screen before the main menu which checked that all banks have been loaded before proceeding to the main menu.

The main menu’s asynchronous loading (WebGL) was trying to use the banks and bus before they were loaded.

Happy to hear that you resolved the issue!