Table of Contents
-
Lessons
On a small hill in the Village, you will find a windmill slowly rotating its blades. While this windmill is an asset like many others in Allegro Kingdom, it also serves the purpose of directing the player towards the Village, with a machinery sound indicating civilization. In the following steps, you will be asked to post the Windmill Event on the Windmill game object using the AkAmbient script.
-
In the Unity menu, select Audiokinetic > Certification > 301 > Lesson 2 > Posting an Ambience.
Notice that two scenes will now appear in the Hierarchy: the Village Environment Scene and the L2_1 - Posting an Ambience. The Village Environment Scene is a region Scene that contains all the Village-exclusive game objects. This Scene is usually loaded and unloaded automatically and would typically not appear in the Hierarchy outside Play mode, but since you will make changes to the Windmill game object inside this scene, it is loaded additively to the L2_1 - Posting an Ambience Scene.
If you want to learn more about managing multiple scenes in Unity, you can visit https://docs.unity3d.com/Manual/MultiSceneEditing.html.
First, we'll need to locate the Windmill game object and add an AkAmbient script to it.
-
In the Hierarchy's L2_1B - Village Environment Scene, expand Wwise and select the Windmill game object.
Let's also adjust the Scene view to look at the Windmill game object.
-
With the Windmill game object selected in the Hierarchy and the mouse inside the Scene view, click F.
Next, you need to add the AkAmbient script.
-
In the Inspector, add an AkAmbient script.
If you are unaware of how to add a script, please visit Lesson 1.
Take a look at the AkAmbient component and observe the properties.
In the added AkAmbient component, you will find the Trigger On, Action on Event, Use Callback, and Event Name properties, which are identical to the AkEvent component. In addition to these, the AkAmbient also includes the Position Type and Show Attenuation Sphere property fields. The Event Name is currently not selected, so let's add the Ambient_Windmill Event.
-
In the Event Name: go to Events > Ambient > SoundBankSpecific and select the Ambient_Windmill Event.
Notice that the Trigger On option is set to Start. As the Windmill should "Start" right away when the game is loaded, we'll keep this option. Let's verify the integration in Play mode.
-
Click Play and then run to the Village.
-
Press ESC to open the WAG menu and click Play again to exit Play mode.
As you approach the windmill, the sound will increase in volume. However, did you notice that the windmill was not playing in the Training Area but started to become audible once nearing it? The Windmill sound is supposed to be audible in the Training Area, like a foreshadowing of civilization nearby, but how do we determine whether it simply has too low a volume or it is out of the Max Attenuation Range? A common method would be to check the sound distance using the Game Object 3D Viewer. However, because you have used the AkAmbient component, you can also use the Show Attenuation Sphere property to quickly visualize and diagnose the Max Attenuation directly inside Unity's Scene view.