Integrating Unity and Wwise Audio: Round 2 - Ambient Emitters by Jeremy Garren

  |  Pyramind  |  

Integrating Unity and Wwise Audio

This guide uses Unity 5 and Wwise Version 2014.1.1, and assumes you have already followed the steps in Round 1 to import the integration package into your Unity project and already know a bit about working in Wwise. 

*Remember - you can get additional help from the Wwise Unity Integration documentation directly from Unity’s Help menu for additionally support!


Step 1: Setting up an ambient emitter

Last time we looked at three crucial components, Ak Initializer, Ak Terminator, and Ak Bank. This time, we’re going to focus on two additional components that will help you get Wwise audio into your Unity scene: AkAmbient and AkGameObj.

a. Create a new Unity GameObject.

From Unity's GameObject Menu, (or from the Hierarchy window) select 3D Object, Sphere. For testing purposes, I chose a sphere for the ease of keeping track of my emitter in scene, but you can use any GameObject.

b. Add the AkAmbient Component.

Select “Add Component” from the GameObject inspector, and then Wwise/AkAmbient. This will result in two component scripts being added - AkAmbient and AkGameObj.

AKAmbient Editor in Wwise

AkGameObj - This script is required on any emitter that uses 3d positional audio. It essentially sends coordinate positions to the Wwise engine to update where the sound should be coming from. So if your emitter moves, or you move, you hear the sound move too! (Also, a Rigidbody component is required for it function properly, so click to add one if you see the red warning.)

AkAmbient - This one does what you would expect, turning a GameObject into a sound emitter, similar to Unity's own "Audio Source" component. These can be used to position zones of sounds for a wide variety of purposes, including ambience, music, or triggered effects. 


Step 2: Link your emitter to a Wwise Event

a. Create a new Wwise Event, or use one you already had prepared.

In the Wwise project linked in the previous guide, create a new event. Set a Play action for your event to associate it with a Wwise container that has some audio content. (For example, I created an event called “Play_Torch” and it plays the Wwise container “Torch”.) 

Wwise event editor

Looping audio content is recommended for this, since you want your sound to be continuous while testing in Unity. Make sure your Wwise object has the Play Mode set to Continuous and/or the Loop box checked in the Property Editor.

b. Add the Event to a Soundbank.

Select your Soundbank in the Wwise Soundbank Manager window and drag in your event to add it to the bank. Make sure that this is the same Soundbank that your AkBank script calls in Unity! (From Round 1) In my case, it is simply the default Main_Bank.

Adding sounds to Soundbank in Wwise

c. Save the project and Generate SoundBanks.

*Note that simply saving your Wwise project will update the list of available Events inside of Unity, but those events won’t play audio unless you generate the related Soundbank first.

Tip - The default Soundbank path is GeneratedSoundBanks\ in your Wwise project directory. Unity can draw from this folder by default when it is linked to a particular Wwise project, but when it’s time to export a game build, the Soundbanks also need to be placed inside of Assets/StreamingAssets/Audio/GeneratedSoundBanks. Curiously, when play-testing inside of Unity, it seems able to read from Soundbanks in either location.

d. Set "Event Name" on your AkAmbient Component

Select your GameObject, and in the AkAmbient Script under Event Name, find your event, which should now appear in the list.

e. Play-test!

Can you hear your sound near your GameObject in scene? If not, you may need to adjust the Positioning settings and Attenuation curve for the object.


3. Adjusting the Attenuation Sphere

a. On Ak Ambient, set "Show Attenuation Sphere" to “Current_Event_Only”

Attenuation spheres in Unity 5 can be viewed as red spheres around your GameObject, representing the space in which the sound can be heard. These spheres cannot be adjusted inside of Unity, only in Wwise, and can be tricky to get to update properly. If you don’t see a sphere yet, don’t panic!

Attenuation Spheres in Unity5

Tip - Other sphere modes can be used to view multiple objects and spheres at once to help determine position and overlap.

*Note that the “Show Attenuation Sphere” setting is only a visual aid for developers and has no effect on gameplay. The setting will also clear automatically when the project is playtested or closed.

b. Check the Wwise Positioning settings.

Select the relevant Wwise object - "Torch", in my case, and navigate to the Positioning tab in the Property Editor. Make sure that “3D” is selected, and that the Position Source is set to Game-defined.

Wwise positioning settings - sound design

Tip - "Enable Spatialization" can be unchecked to make the sound play in it's original mono, stereo format without game engine pan and doppler effects. This can be very useful for music or stereo ambiences that you don't want to hear positioned from a point source.

c. Adjust the Wwise Attenuation curve.

In the 3D Attenuation section, click the double arrow box and select “New”. Give it a name, in this example mine will be “Torch Distance”. Click the Edit box to bring up the Attenuation Editor. 

Wwise attenuation editor

Set “Max distance” to something that makes sense. A good default range might be between 10 to 30 units, although this will vary depending on game scale and on the type of sound you wish to implement. In my case, I want the torch to be at maximum volume within a short distance, and then volume to roll away gradually up to 12 units away.

d. Save/Generate Soundbanks, and play-test!

*The visual Attenuation Spheres typically won’t update until you play the scene in Unity at least once to get fresh data from the Soundbanks.

If all has gone well, you now have a functioning Wwise-powered ambient emitter, and can begin to build layered soundscapes inside of your Unity scene!


The game scene in this guide is “Viking Village”, a free download published by Unity Technologies. Check it out here: https://www.assetstore.unity3d.com/en/#!/content/29140

Contact Us