A demonstration scene containing the Wwise Unity Integration, is available through the WwiseDemoScene Unity package. 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.
Note that the Wwise Demo Scene is a complete project that was created with Unity 5. It is not compatible with Unity 4. If you wish to view the it in Unity 4, please download and import the 2014.1.3 Wwise Demo Scene.
The Wwise Demo Scene is a standalone project. It should not be used as a foundation for your game. Use the
WwiseUnityIntegration_*.unitypackage packages for this purpose.
To install the Wwise Demo Scene:
- Create a new Unity project in the Unity Editor.
- Double-click on the WwiseDemoScene.unitypackage file, or in Unity, use the Assets > Import Package > Custom Package menu. Import all assets from the package.
- When the package import is complete, open
<DEMO_SCENE_ROOT>/Assets/WwiseDemoScene/WwiseDemoScene.unity, and preview the scene in the Unity Editor.
- The Wwise setup steps and SoundBank generation are included in the package.
- You can find the Wwise Project associated with this scene under
<DEMO_SCENE_ROOT>/Assets/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:
- Import the Wwise Unity Integration Unity Package for your desired platform in your WwiseDemoScene Unity Project.
- Generate the SoundBanks for the platform.
- Copy the Generated SoundBanks folder to the StreamingAssets/Audio folder.
- Build the scene for your desired platform, and deploy to the device.
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" checkbox is checked (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
uIdentifier field as an index. See How to use AkEvent and 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).
Generated on Tue Aug 23 02:45:00 2016 for Wwise Unity Integration by 1.6.3