Lesson 2

Table of Contents

Using Multi Position Mode

A common approach to minimizing redundancy in Unity is to use modular objects like Prefabs to save many types of information in one piece. Take the Torch Prefab. It contains components that describe where it is, how it looks, and how it should behave. By adding an AkAmbient component to your Prefab, you ensure that the Torch sound will be included whenever someone adds a torch to the Scene. This is possible using either the AkEvent or AkAmbient script, but best suited for those purposes is the AkAmbient with a Position Type set to MultiPosition mode. While this mode is used to play an Event from the attached game object, just like the AkEvent or the AkAmbient's Simple mode, the MultiPosition mode allows you to only have one instance of the Event, no matter how many AkAmbient components that might have been added to the level.

In the following steps, you will add an AkAmbient component to the 301_Torch Prefab. You will start by having the AkAmbient set to Simple and then change it to MultiPosition Mode, to demonstrate the difference in voice instances.

  1. Ensure that the AkAmbient Position Types Scene is open (Audiokinetic > Certification > 301 > Lesson 2 > AkAmbient Position Types).

    To familiarize yourself with the Torch sounds, let's start by auditioning them in the dungeon. Meanwhile, connect the Profiler and take a look at the current amount of voice instances corresponding to the amount of Torches (17) in game.

  2. In Wwise's toolbar, click Remote…

  3. Select the Wwise Adventure Game (Editor) then click Connect.

  4. In Unity, click Play to enter Play mode.

  5. Press ESC to enter the game menu and teleport to the Dungeon.

  6. Run through the corridor and observe the sounds of the torches.

    Notice that the Torch sounds are all positioned directly at the Torch game objects, meaning that for each you pass by the sound will increase and decrease in volume.

  7. Press ESC to open the WAG menu and click Play again to exit Play mode.

  8. In the Wwise menu, go to Layouts and select Voice Profiler.

    Let's focus on only monitoring the Ambient_Torch Event by assigning it in the filter.

  9. In the Performance Monitor, drag the time cursor backwards until you see the 301_Torch in the Voice Inspector.

    Take a look in the Voice Inspector's leftmost panel. This panel will list all active game objects and associated voices from the capture in the Voice Monitor. Notice that there are more than 10 voices using the Ambient_Torch Event. Let's now set the positioning type to MultiPosition mode and observe the change.

  10. Back in the Unity Hierarchy, search for 'Torch' and select the 301_Torch_01 game object.

    A blue game object in the Hierarchy means the game object refers to a Prefab asset. Prefabs are templates of game objects. Dragging a Prefab in the Scene will create a game object identical to the Prefab and whenever the Prefab is modified, the changes will automatically be applied to any game object originating from that Prefab. To make changes to the Prefab, you can select it in the Project view and perform the desired changes in the Inspector. However, you can also make changes to the Prefab's game objects in a Scene and then send the changes back to the Prefab. Let's modify the AkAmbient on the 301_Torch_01 game object and apply it to the original Prefab.

    [Tip]

    To learn more about Prefabs you can visit https://docs.unity3d.com/Manual/Prefabs.html.

  11. In the Position Type property, select Multi Position_Mode.

    Next, you need to send the changes back to the original Prefab. To do so, you need to 'Apply' the component you've change on the game object.

  12. In the Inspector, right-click AkAmbient and select Modified Component > Apply to Prefab '301_Torch' to apply the property changes to the Prefab.

    You have now saved the changes of the 301_Torch_01 game object into the 301_Torch Prefab which have made all other Torch game objects inherit the same properties.

  13. In Wwise, click Reconnect.

  14. In Unity, click Play to enter Play mode.

  15. In the game menu, teleport to the Dungeon.

  16. Run into the dungeon entrance corridor and back, while observing the sound of the torches.

    Notice that the Torch sounds are still positioned at their corresponding Torch game objects, like it was multiple AkEvent voices playing concurrently.

  17. Press ESC to open the WAG menu and click Play again to exit Play mode.

Back in Wwise's Voice Inspector, notice that the numerous Event instances in the leftmost panel have been reduced to only 1, dispite having provided the equivalent audio output. In the Voice Inspectors rightmost panel, the individual torches Distance Attenuations will be displayed.

From now on, if you were to add any torches to the Dungeon, you'd keep an instance count of 1 because you are using the MultiPosition Mode on any Prefab you add to a Scene. This makes the MultiPosition mode ideal for collaboration with level designers because the sounds are embedded into the objects, no matter where it's placed or moved, and without any additional audio performance expense.

[Note]

Keep in mind that the MultiPosition mode is only using one instance, so each sound position will be playing the same voice. As such, you cannot use the Randomizer to create sonic diversity between your sound positions.


Was this page helpful?