Version
A demonstration scene containing the Wwise Unity Integration, is available to download from the Wwise Launcher Unity page, under the contextual menu in the "Recent Unity Projects" title. This simple scene, created using Unity's standard assets exclusively, demonstrates how to use some of the Integration's basic features.
This First-Person 3D map contains "stations" along a path. For each station, a small description was made available on a sign next to the station. For easy reference, each station's assets have been nested in the scene hierarchy.
The Wwise Demo Scene is a standalone project. It is available to download in the Wwise Launcher. It should not be used as a foundation for your game. Use the Wwise Launcher to integrate Wwise in a new Unity project for this purpose.
NOTE:
<DEMO_SCENE_ROOT>/WwiseProject
. Leaving the Wwise project in the game's Assets folder is not recommended, but was necessary in this Demo for packaging purposes.The Wwise Demo Scene is intended as a way to preview and show how the Wwise Unity Integration should be done in the Unity Editor.
To deploy the Wwise Demo Scene to a game console or mobile device, follow these steps:
The footpath, along with the first station, demonstrates how to use scripting and trigger volumes to create a footstep system.
In the Wwise Project, footsteps have been implemented in the recommended way: Random containers for each surface type, nested under a Switch Container. A footstep can be posted using the Footstep
event, and the surface material is controlled with the Footstep_material
switch group.
The scene's terrain has been painted with four different textures: grass, gravel, wood, and dirt. Walking around the different surface types changes the footstep sound accordingly.
To accomplish this, Box Colliders have been placed over each zone. Setting the Footstep_Material
switch is then done simply by dragging a Switch Value from the Wwise Picker Window to a Box Collider. In order to set the switch on the First Person Controller when it enters the collider, we need to trigger the Ak Switch script on the "AkTriggerEnter" trigger, and make sure the "Use Other Object" check box is enabled (as seen in the Inspector Window).
A very rudimentary footstep script has been implemented, which simply posts the Footstep
event every 0.3 seconds when the player is moving. This script has been attached to the First Person Controller. This illustrates a way to post an event to the Wwise SoundEngine via scripting.
This station illustrates how to create custom event triggers in Unity, as well as using event callbacks.
A simple button script contains a delegate to be run when the player is close enough to the button, and presses a key on the keyboard or controller. Another script, AkTriggerButtonPress
, registers itself on that delegate, and then calls triggerDelegate
from its parent class AkTriggerBase
. Inheriting from AkTriggerBase
allows the custom trigger to show up in the "trigger" list in Wwise Component Inspector windows (for example, the Ak Ambient attached to the button). For more information on custom triggers, see Adding New Triggers for Wwise Events.
The event starts playing a sound file containing WAV markers. Registering the marker callbacks associated with the event allows the updating of the subtitle on the panel. To achieve this, in the Ak Ambient's inspector, the "Use Callback" option was checked. Then the GameObject (SubtitleSign
), containing a script (SubtitleDemo.cs
), was dragged & dropped onto the "Game Object" box. The name of the Callback Function (MarkerCallback
), to execute when the callback is triggered, was typed and "Marker" was chosen as the Callback Flags. Looking at SubtitleDemo's
code, it can be seen that the Callback function is simply reading the subtitles from a pre-defined string array, using the MarkerCallback's
uIdentifier
field as an index. See How to use AkAmbient with the inspector for more information on callbacks.
This station demonstrates how to apply effects on sound within a zone in the scene. Two caves contain an EnvironmentZone (once again, a Box Collider is acting as a trigger) on which an AuxBus has been added (Dragged & Dropped from the Wwise Picker window).
In Wwise, two Auxiliary Busses have been created, each containing a different effect. Furthermore, the footsteps and the Little Sequence have "Use game-defined Auxiliary sends" checked.
When a Wwise event is posted from within the EnvironmentZone, its sound is routed to the AuxBus associated to the zone.
This station also demonstrates the Environment Portal component. This allows a spatial transition between two environments. The three buttons in this demonstration are used to illustrate how an Environment Portal affects the mixing of the Auxiliary Busses.
To create an environment portal, first create a Box Collider that touches two Ak Environments on one of its axes (in this demonstration, the portal touches the Red zone and the Blue zone on the 'z' axis). Then add the Ak Environment Portal component, and select the correct axis. The two environments, which will be mixed, will be automatically filled in.
For more information on Environments and Environment Portals, see How to use AkEvironment and AkEvironmentPortal with the inspector (Reverb Zones).
Questions? Problems? Need more info? Contact us, and we can help!
Visit our Support pageRegister your project and we'll help you get started with no strings attached!
Get started with Wwise