Table des matières

Wwise Unity Integration Documentation
Preparation for the Spatial Audio Tutorials

The following steps must be followed beforehand to successfully complete the Surface Reflectors Tutorial and the Rooms and Portals Tutorial :

Note: If you don't want to start a new project from scratch, you can download the Wwise Unity Demo Scene. It contains a scene, called SpatialAudioTutorial, with all the steps from the tutorials.

1. Create a Unity Project

Using the latest version of Wwise and Unity, follow the steps below in order to build your working environment.

  1. Launch Unity and create a new project.
  2. Close Unity.
  3. Start the Wwise Launcher and integrate Wwise into your Unity project.

2. Wwise Project Preparation

For the tutorials, you will need a Sound SFX, an Event to play it, and a SoundBank.

  1. From the Launcher, open your project in Wwise.
  2. Add a Sound SFX under the Actor Mixer Hierarchy's Default Work Unit.
    1. Import a sound into it.
    2. In the Sound Property Editor's
      1. General Settings tab, enable Use game-defined auxiliary sends.

        Sound Property Editor General Settings tab
      2. Positioning tab, enable Listener Relative Routing and select Position + Orientation for the 3D Spatialization. Add an Attenuation with a reasonable Max Distance.

        Sound Property Editor Positioning tab
  3. Right-click on the Sound SFX within the Actor-Mixer Hierarchy, then select New Event > Play.

    Event Editor
  4. Go to the SoundBank layout (shortcut F7) and add a new SoundBank. Drag the Event into the new SoundBank. Here's how the SoundBank Manager look in the Wwise Unity Demo Scene Project:

    SoundBank Manager and Editor
  5. Save your project.

3. Unity Project Preparation

In this section we will create our game area and the objects in it. We will need a listener, emitters, and two rooms.

From the Launcher, open your project in Unity. Open the Wwise Picker (Windows > Wwise Picker), Refresh Project, and Generate SoundBanks.

Wwise Picker
  1. Create a character with the method of your choice.
    1. Remove any Unity Audio Source.
    2. Add an AkSpatialAudioListener component to the GameObject acting as your listener.
      AkSpatialAudioListener component
    3. Adding an AkSpatialAudioListener component will automatically create an AkAudioListener, AkRoomAwareObject and AkGameObj component.
      AkAudioListener component
      AkGameObj component
      AkRoomAwareObject component
      1. In the AkGameObj component,
        1. Uncheck the Environment Aware checkbox.
        2. Enable the Use Default Listener option.
      2. In the AkRoomAwareObject component you may see up to two warning messages. Since we are not yet using AkRoom components, you can ignore them for now. We'll come back to it in the Rooms and Portals Tutorial. You can disable the component if you are not planning to use AkRoom components at all in your game.
  2. Create a floor, a building with two rooms and an obstacle outside using your preferred method.
    In the Wwise Unity Demo Scene, we used a mesh for the building and cubes for the floor and obstacle ( GameObject > 3D Object > Cube ).

    Tutorial Unity Scene
  3. Create emitters with the method of your choice. In the Wwise Unity Demo Scene, we created buttons using cylinders ( GameObject > 3D Object > Cylinder ). We added a button outside and inside each room.

    For each emitter:
    1. Add an AkAmbient component:
      1. Choose your preferred way to start the sound in Trigger On.
      2. Choose the Event in Name.
        AkAmbient component
    2. In the AkGameObj component (added automatically after adding an AkAmbient component):
      1. Enable the Use Default Listener option.
        AkGameObj component
    3. Add an AkBank component:
      1. Add the SoundBank created in the previous section to Name.
        AkBank component

4. Verify your Setup

  1. Start the game and connect it to Wwise,
    1. Open the Profiler layout (shortcut F6).
      1. Play the sound from a button. You should hear the sound you imported in the Wwise project.
      2. In the Voices Graph tab, you should see the following graph:
        Button Outside Voice Graph with no Effect
      3. In the Profiler settings, reachable from the gear icon in the top right corner of the Advanced Profiler view, make sure Spatial Audio is selected to be able to see Spatial Audio drawings in the Game Object 3D Viewer (next step).
        Profiler Settings
    2. Open the Game Object Profiler Layout (shortcut F12)
      1. Add all the emitters and the listener to the watch list.
      2. In the Game Object 3D Viewer, you should see all your game objects.
        Game Object 3D Viewer
  2. Save your Scene to a convenient place.