To integrate FMOD into Unity, you need the FMOD-Unity Integration Plugin from Firelight Technologies. Note that FMOD Studio and the FMOD Unity Integration should use the same version to avoid compatibility errors. For all tutorials I’ll use FMOD Studio 2.0.1 and Unity 2019.1.2f1, but everything works also with newer FMOD/Unity versions.
Check out the video version of this tutorial:
Install the FMOD integration package into Unity
Open and import the downloaded .unitypackage file into your Unity project. The Unity console probably will display an error message mentioning a missing FMOD Project folder:
The reason for this error is pretty simple: the plugin needs a link to the FMOD Project or to the exported banks. Otherwise it cannot know what to look for.
Generate FMOD Banks and connect the FMOD Project to Unity
Create a new FMOD Studio project by opening the FMOD Studio application and press File>New and then File>Save as. The project can be saved to any folder on your hard drive. We return to Unity and click on FMOD>Edit Settings. Then select the FMOD Studio project file in the Studio Project Path field.
Every time we build our FMOD project (File->Build…), the FMOD banks are loaded into Unity, so we can access the FMOD project events in the inspector and C# code.
- If you are going to work with GIT in the future, you will need to save your FMOD Studio project folder in the Unity project so that your team has access to the banks. Saving the project to the Assets folder is not recommended, as the banks will take up unnecessary space in the final game build.
- Alternatively, you can export only the FMOD Banks in the Unity Project folder while the FMOD Studio project is on your local hard drive. Both options work fine!
- If you only want to export the banks, select the option Single Platform Build or Multiple Platform Build in Unity’s FMOD settings.
FMOD Studio Listener Setup
The last step to take care of is the installation of an FMOD listener. The listener defines where the audio engine “hears” all FMOD events from. Imagine they were real player’s ears. Often the listener is attached directly to the camera, but this has not necessarily to be the case in every situation.
To add a listener, open the Main Camera GameObject in the hierarchy window. Then navigate through the inspector, click the Add Component button below and add an FMOD Studio Listener.
Once all this is done, we can finally take a look at the FMOD Studio Events and write the first code for our sounds!