If you haven’t already set up and prepared FMOD Studio, feel free to visit Part 1
Next Open Unity Hub
Create a new 3D unity project
Install FMOD Unity Integration Package either by downloading it from the FMOD website and importing or dragging it into your unity project
https://fmod.com/download#fmodforunity
Or download the FMOD Unity integration package from the Unity Asset Store and import it into your project
https://assetstore.unity.com/packages/tools/audio/fmod-for-unity-161631
Once you have installed the FMOD Unity Integration Package within Unity or dragged the package into your project
Go through the setup wizard and follow the steps until all the yellow items are green
You don’t need to make any changes on this screen so just click next.
As we’ll be using FMOD Studio for this task, click FMOD Studio Project and click next
Select the FMOD Studio Project and locate the build file you just created in the last step
When you have selected the project, you will get a green light for the project location on the next screen
Next replace the built-in Unity Listener by clicking on Replace Unity Listener with FMOD Audio Listener. Click Next.
Then disable built-in audio
Then once disabled just click on next again
If it says no Unity Audio Sources found that is ok as we are now using FMOD audio.
If you are using Source Control then you can follow instructions here. We aren’t in this example so you can skip it.
So if you arrive at the following screen and everything is green, you can close the wizard and work directly in Unity
To create a simple working example that uses the file we created in FMOD studio
Create an empty GameObject in the Unity scene and add the "FMOD Studio Listener" component to it by clicking "Add Component" in the Inspector and selecting "FMOD Studio."
When we ran the wizard this added the FMOD studio listener to the main camera but we can create a simple cube to the screen and add the FMOD studio Listener to that object if required.
In the Unity scene, select the cube and add the "FMOD Studio Event Emitter" component to it by clicking "Add Component" and search for the FMOD Studio Event Emitter"
In the "FMOD Studio Event Emitter" component, drag the "Event" you created by clicking on FMOD in the top menu in unity and open the Event Browser. Click on the Events drop-down and you should see the Soundtrack Event
Drag the Soundtrack Event into the FMOD Studio Event Emitter Event box in the inspector
Select the Start Event as Mouse Enter
Select the Stop Event as Mouse Exit
Press play in Unity and click the button to hear the sound play when you hover the mouse over the Cube
If all worked well, when you hover over the cube with the mouse in play mode, you should hear your soundtrack file playing and if all worked as intended, it should raise the pitch over time.
I hope this introduction to FMOD Studio Integration with in Unity was of use to you. Please feel free to comment if you have any thoughts about it. In the next post, I’ll start to experiment with different effects and more interactive elements to trigger in Unity.