When we started working on the audio in Trespassers, we were working with the built-in audio system in Unity3D. Our designer did not have control over it. He teleworks, so the workflow needed to be as smooth as possible, as he couldn’t test the results so quickly to check the whole process. As he had attended to FMOD lessons, we decided to give it a try. Although as a developer (programmer) I feel that the integration in Unity could have some things improved (*), FMOD is a really great tool. The documentation and “getting started” section may be a bit sparse, in the line “Do this and you are good to go”, sometimes you need to know a bit more.
Problems arose when we needed fading sounds with distance, so players travel between different soundscapes created while playing. Trespassers is a 2D game, so we don’t need to have the 3D positioning options enabled, just 2D. The distance filter proved to be the solution, but here Unity started throwing runtime errors like this:
BankLoadException: FMOD Studio could not load bank ‘Assets\FMODBuild\Desktop/Master Bank.bank’ : ERR_PLUGIN_MISSING : A requested output, dsp unit type or codec was not available.
The message was a bit cryptic, and happens with other plugins that you may have missed. Let’s go straight to our “solution”, as it may not work for every platform:
- Open de FMOD settings (FMOD -> Edit settings)
- Click on “Add plugin” in the Plugins section (the one above Platform specific overrides)
- Put the name of the plugin missing. “Where to I find?” Here is the trick. Go to your “plugins” folder inside the FMOD installation folder, like:
C:\Program Files\FMOD SoundSystem\FMOD Studio 1.08.02\plugins
There you will find some dlls, namely fmod_distance_filter and fmod_gain. Copy the name, without the extension, and paste it into the blank space that appeared when you clicked on “Add plugin”
- Don’t leave that folder! Copy the dll you wanted, and place it inside the Unity3D plugins folder depending your target platform, the one you are compiling for. For example: “Plugins/x86_64”.
We got to that point after checking the FMOD log (FMOD -> Log viewer). Here, a line appeared that seemed related to the problem:
[WRN] PluginEffectModel::init : Missing DSP plugin ‘FMOD Distance Filter’
This shed some light. FMOD documentation states that, in case you need some plugins imported, just copy the dll to the project and set up following the steps above, but we got a bit lost trying to figure out the names to use and where to search for plugins.
There may be one caveat with that solution, depending on your case: how do you get the pluging library for other systems? Maybe this is something we can ask FMOD developer, Firelight Technologies, in case you wanted to port the game to Xbox One, Wii U …
Hope it helps you with this problem. Leave a comment if you have further information about the cross platform solution ;).
(*) Getting the actual FMOD audio event assigned to an object at editor time, rather than runtime, doesn’t seem to be straightfoward, as you need a public string with the EventRef attribute tagging it, and then, at runtime, fetch the audio event from FMOD. Maybe it is just “impossible” to bind the path stored in the string to the event at anytime but runtime. Fortunately, the FMOD plugin provides Attributes for custom views in the Inspector.