Hey everyone! Today I’m starting a new series where I’m going to implement sound and do sound design for the Platformer Microgame that you can get access to in the Unity asset store. This series is intended for you to follow along with, learn some new things about FMOD, Unity and C# and also get a good little project for your demo reel. I’m going to be using FMOD 2.04 and Unity 2018.4, so if you don’t have those installed, do it now before we begin. Hope you have fun!
Downloading The Project
First, open up Unity Hub and select “Create New Project”. Select the 2D template and give your project a name.
Inside of Unity, click on the “Asset Store” tab and search for microgame in the search field. “Platformer Microgame” should pop up in the results. Click on it and then click import.
Now with the game imported into your project, navigate to the “SampleScene” on the screenshot below and double-click it to open up the game.
Once you open up the scene, you’ll see a highlighted box called “Walkthrough” pop up. If you don’t have that much experience with Unity, I recommend that you go through this and learn some basic stuff. If you already know Unity, you go ahead and close it by click on the “X” icon in the top right of the box.
We don’t need the audio engine that comes with Unity, so let’s disable that to start with. Click on “Edit” in the top left and open up the “Project Settings”.
If you click on the “Audio” tab in the project settings, you’ll see an option to “Disable Unity Audio”. Check it. This will disable the Unity audio engine, so that no audio sources or anything will play any sound.
To implement FMOD into our Unity project, we need to download the integration package from the FMOD site. Download the one that is the same version as your current FMOD version, in my case that’s 2.00.04. Once you download it, you should get a file that looks something like the screenshot below.
Drag that file into your Unity project and the import package screen will open. Click “All” and the “Import” and voila, FMOD is implemented into your project.
Getting the FMOD Project Hooked Up And Testing
Open FMOD and click “New Project”.
Right-click in the event browser and create a new 2D event. We’re going to be implementing some sort of ambience for testing purposes.
Name your new 2D event “Ambience”, then right-click on it and assign it to the “Master” bank.
Now, find (or record) some sort of ambience and drag the file into the “Ambience” event. As you can see on the screenshot below, I’ve just chosen some generic space ambience. In general, if you need to put a new sound into FMOD, you just drag it into the event where you need it.
Right-click on the sound file and click “New Loop Region”. This will make the sound file loop indefinitely, which is what we want in this case for the ambience. Before exiting FMOD, make sure you build your project by clicking F7.
Now that we have a sound that we can use to test if everything works, we need to hook that FMOD project up to our Unity project. In Unity, you’ll see a new FMOD tab in the top. Click that and click on “Edit Settings”.
On the right side of the screen, in the inspector, you’ll see a red error looking icon. What we basically just need to do here, is just click on the browse button and find our FMOD project, so the Unity project knows where to find our sounds from.
This is what my FMOD project looks like and what the file you need to find should also look like.
After you’ve found and clicked on the FMOD project, this is what the inspector tab that you looked at before should look like.
Now, for the final step. Right-Click in the hierarchy on the left side of Unity and create a new “Empty Gameobject”, name this “Ambience”. Click the “Add Component” button and search for the “FMOD Studio Event Emitter”. Set the play event to “Object Start” and the stop event to “Object Destroy”. This will make the sound play and stop whenever the gameobject is spawned into the world and when the object is destroyed or removed somehow. What this basically means for us, is that when we play the game, the ambience starts. Now, click the little magnifying glas icon next to “Event” and navigate to the “Ambience” event we made before, click it.
And that’s basically it, you should now be able to press the play button, play the game and hear the ambience you’ve chosen.
That’s it for part 1 of the series! Hope you learned something new, see you next week! 🙂