Wwise Unity Integration Documentation
The Integration provides Wwise-specific components you can use directly on Unity Scene GameObjects. These components should cover most sound design scenarios. While the components are custom C# scripts, no coding is required to edit their public properties.
To add Wwise components to Unity GameObjects:
|Tip:||Type "ak" in the component search field to more quickly access a list containing all the Wwise components.|
You can add components to your game by dragging Wwise objects from the Wwise Picker to either the Inspector or onto game objects listed in the Hierarchy of your loaded scene.
The WwiseGlobal object is a GameObject that contains the Initializing and Terminating scripts for the Wwise Sound Engine. In the Editor workflow, it is added to every scene, so that it can be properly previewed in the Editor. In the game, only one instance is created, in the first scene, and it is persisted throughout the game. There are a few customizable options in the initializer script.
If you want to disable this behavior, use Edit > Project Settings > Wwise Editor and disable Create WwiseGlobal GameObject. It then becomes your responsability to add the initializer script on an object that will persist throughout the game.
In order for positioning to work, the Ak Audio Listener script needs to be attached to the main camera in every scene. By default the listener is added automatically to the main camera. If you want to disable this behavior, go to Edit > Project Settings > Wwise Editor and disable Automatically add Listener to Main Camera.
This integration also provides a few classes that can be used, with minimal code, for most remaining usage scenarios:
A native WAAPI client with a C# API allows you to connect to WAAPI from within Unity. It currently is available for Windows and macOS. The Wwise Authoring API sends messages via JSON objects. In Unity, the client was implemented using strings. You may use your preferred method to construct valid JSON strings to then give to the WAAPI client.
There are four ways to add sounds to your game:
AK.Wwise.Event.Post()at any time from a C# script.
AkSoundEngine.PostEvent()at any time from a C# script.
For Unity's Timeline feature, there are custom Wwise tracks for triggering Wwise events and setting Wwise RTPC values.
When Wwise sound objects are part of an audio timeline in Unity, applying Initial Delays to those sounds can be problematic. For example, if you use a seek, the seek is done in the silence generated to create the Initial Delay instead of in the sound itself, so the sound starts from the beginning of the file and not from the specified timestamp. To start sounds after a delay, use the Unity Timeline instead of a Wwise Initial Delay: move the clip to the desired timestamp in the Timeline.