menu
Wwise
arrow_drop_down
Strata
arrow_drop_down
Solutions
arrow_drop_down
Apprendre
arrow_drop_down
Communauté
arrow_drop_down
Documentation
arrow_drop_down
Aide
arrow_drop_down
2024.1.4.8780
2023.1.12.8706
2022.1.18.8567
2021.1.14.8108
2019.2.15.7667
2019.1.11.7296
2018.1.11.6987
2017.2.10.6745
2017.1.9.6501
2016.2.6.6153
2015.1.9.5624
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:
check_circle | 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 > Wwise Settings 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 > Wwise Settings 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:
AK.Wwise.AuxBus
AK.Wwise.Bank
AK.Wwise.CallbackFlags
AK.Wwise.Event
AK.Wwise.RTPC
AK.Wwise.State
AK.Wwise.Switch
AK.Wwise.Trigger
AK.Wwise.AcousticTexture
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.
The Unity integration includes a simple WAAPI client that can be used to interface with the Wwise Authoring tool.
Most Wwise SDK functions are available in Unity through the AkSoundEngine
class. Think of it as the replacement of C++ namespaces AK::SoundEngine
, AK::MusicEngine
, and so on. See API Changes and Limitations for changes made in the API binding compared to the original SDK. For more complex situations, you'll need to call Wwise functions from code. In the API, the GameObjectID
in all functions is replaced by the Unity flavor of the GameObject. At runtime, an AkGameObj component is automatically added to this GameObject, unless you have already manually added it before.
The native Wwise API allows you to use strings or IDs to trigger events and other named objects in the Wwise project. You can still do this in the C# world by converting the file Wwise_IDs.h
to Wwise_IDs.cs
. Click Assets > Wwise > Convert Wwise SoundBank IDs. You need to have Python installed to make this work.
MIDI can be sent to Wwise by filling the AkMIDIPost
members of AkMIDIPostArray
class and calling any of the following methods:
AkMIDIPostArray.PostOnEvent()
AkSoundEngine.PostMIDIOnEvent()
AK.Wwise.Event.PostMIDI()
The following is a basic script that sends MIDI messages to the sound engine:
The audio input source plug-in can be used via C# scripting. See Audio Input Source Plug-in from the Wwise SDK documentation.
The following is a basic script that sends a test tone to the audio input source plug-in:
By default, the AkGameObj
component is attached to a specific Unity gameObject
and uses its transform (with an optional offset) for full positioning. This is usually adequate for many games, such as first-person shooters. However, games with custom camera angles, such as many third-person games, may find it difficult to accommodate the two aspects of positioning (distance attenuation and spatialization) by simply attaching the audio listener to one game object, such as the main camera in Unity. Other games may want players to experience other custom positioning.
To this end, the AkGameObj
component class provides overridable positioning to Unity users. Through the three virtual methods GetPosition()
, GetForward()
, and GetUpward()
, users can derive a subclass from AkGameObj
and use that subclass component to customize any number of Unity gameObjects'
positioning.
Here is a simple example of how to use a custom component to override the default AkAudioListener
behavior. With a third-person project integrated with Wwise, remove the existing AkAudioListener
and its associated AkGameObj
. Then attach the following script to the MainCamera object, attach AkAudioListener
, and finally specify the target Unity gameObject
(such as the player avatar) that the audio listener's position will follow. After this, the distance attenuation of all the emitters will rely on the selected target Unity gameObject's
position as the listener position (an on-screen distance listener), while the orientation of all the emitters is still based on the main camera orientation as the listener orientation (an off-screen orientation listener).
Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !
Visitez notre page d'AideEnregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !
Partir du bon pied avec Wwise