In Rapid Prototype Production at FIEA teams of four or five developers are tasked with making a game… in two weeks. This week we completed our second RPP project, and I had the privilege to work on two core learning outcomes I considered important to my growth as a developer. I’ll address one of those goals right here in this blog post.
The first of my learning objectives was to figure out how to integrate Wwise into a Unity project. Wwise is an audio management software that connects to the major commercially available game engines to facilitate the implementation of sound effects. I only had two weeks to learn this software so my understanding at this point is certainly very surface level. That being said, I was unhappy with the tutorials I found online, so here’s my quick and dirty tutorial for getting started with Wwise in Unity.
Integrating Wwise with Unity
2: Create a Unity project, and go ahead and make a canvas and a button object. (This tutorial assumes you have surface level knowledge of Unity)
3: Open the Wwise launcher, and select the Unity tab. It should autodetect the Unity project you made. Make sure to close your Unity project first.
4: Select Integrate Wwise, default settings should work just fine, but comb through them nonetheless.
5: Restart your Unity project, now within the Unity editor you should see a WwisePicker tab (if you don’t see it it should be in the Windows tab). This is where you will find all of the events and sounds you import into Wwise, and therefore can use in your project. You might also notice the audio listener on your camera object has been replaced with new ‘AK’ components.
6: Download a good, short, sound effect. My go-to is a short pop sound. I’ve included one here, but any .wav file should work.
7: Open Wwise either from the Unity tab in the Wwise launcher (the ‘Open in Wwise 2018…’ button in the above image), and make sure your layout is set to ‘Design.’ The hotkey is F5.
8: On the left side you should see a tabbed window with Audio, Events, Soundbanks, and many more. Make sure Audio is selected to start.
9: Find the Actor-Mixer Hierarchy, and right click the Default Work Unit. From there select Import Audio Files.
10: Click ‘Add Files…’ and select your desired audio file, and finalize the import. With that you will now have your audio file in your Wwise project, but it’s not yet associated with a game event yet.
11: As you may have guessed, now select the ‘Event’ tab. Once there, right click the Default Work Unit, select New Child, and select Play.
12: Wwise will ask you for a name for the event, this is vital. The name of your event MUST match the name you plan to call in the script. If you are using my pop.wav sound, go ahead and name the event “Pop”
13: In the center window you should now see a sound effect element with an empty ‘Target’ field. Right click that field and select browse. Wwise will open a window to have you select which audio track or tracks you would like to play. Select your pop from the default work unit.
14: Test your event by pressing the play button in the bottom tab. You should hear your audio, and see a meter on the right that shows you the peak volume of the track. If you properly hear your pop sound you’re on the right track.
15: Next we will make a soundbank. In your game your soundbanks are the repositories for all of the audio events you want to trigger. It’s easily accessible from Wwise once you generate it. To access soundbanks you’ll need to change up the layout. We want to navigate to the Soundbanks layout. This is in the Layouts tab OR you can press F7.
16: Here you see your Default Work Unit. Right click that within the Soundbanks tab and select New Child then Soundbank. The name of this soundbank isn’t vital for this purpose. I suggest calling it ‘Main’. You should see this soundbank appear in the center window.
17: Navigate to the Events tab, and drag and drop your Pop event into the new soundbank in the center window. This adds the Pop event to your soundbank. You can see it’s there in the center-lower window.
18: Save your project! And select ‘Generate All’ at the top of the soundbanks menu. A window should appear confirming your soundbanks were generated.
19: Save again, and we can now move back into Unity!
20: In Unity create a ‘ButtonSound’ C# script. Open the script and write a method that runs the following line of code. This method will be called when the button is pressed.
AKSoundEngine.PostEvent(“Pop” , gameObject);
21: Next, attach the script to your button object, drag and drop your button object into the button OnClick() space, then select the drop down menu, and find your ButtonSound script and select your menu.
22: If you test you might notice you don’t hear the sound when you click the button, and Wwise throws an error. To correct this you need to select your Main Camera object. Navigate to your WwisePicker tab, and drag your ‘Main’ soundbank from the WwisePicker onto the camera as a component.
23: Now when you play you should hear the pop sound every time the button is clicked! You’ve successfully used Wwise to play an audio event. This might not seem faster or more useful than Unity’s default audio manager, but as a project grows in size Wwise becomes more and more useful as a hub for your sound effects, music, voiceover, and ambience.
I hope Wwise works for you, and this introduction serves as a helpful guide on getting started. For any questions about this feel free to contact me through any of my communication channels!