Lesson 1

Table of Contents

Playing Your First Wwise Event

To post a Wwise Event in Unity, Wwise needs to know two pieces of information:

  • The referenced game object.

  • The Trigger mechanism.

Unless specified otherwise, the Event will refer to the game object you attach the AkEvent script to. That game object will be used as a reference to calculate distance attenuation, Game Parameter values, Switches, and so on. In the AkEvent component, you will find a Trigger On property where you can select various Trigger methods.

We will add the 301_Campfire game object, post the Ambient_Campfire_Play Event when attached to it, and try to understand how it's placed in a 3D space.

[Tip]

In the Wwise Adventure Game, the listener is attached to the Main Camera but a distance probe is attached to the Player, so any sound calculates distance based on the distance to the Player.

  1. In the Unity menu, select Audiokinetic > Certification > 301 > Lesson 1 > Playing your first Wwise Event.

    First, you will find the 301_Campfire Prefab and drag it into as a new game object.

  2. In the Project view, search for 'Campfire'.

    This is simply one of many Prefabs and game objects you can select in the Wwise Adventure Game.

[Note]

If you are not seeing a list in the Project view, you can change to it by dragging the bottom right slider all the way to the left.

  1. Drag the 301_Campfire Prefab into the Scene View.

  2. Use the Move tool (click 'W') to place it on the ground in the Training Area.

    As you have now added a game object to the scene, you can post an Event attached to it. As previously mentioned, a convenient way to add an Event to a game object is to use the Wwise Picker.

  3. In the Wwise Picker, open Events > Ambient > General and select the Ambient_Campfire_Play.

  4. From the Wwise Picker, drag the Ambient_Campfire_Play Event onto the 301_Campfire game object in the Hierarchy.

    And done! By dragging the Ambient_Campfire_Play onto the 301_Campfire game object, we automatically set the Event to Ambient_Campfire_Play and added the necessary scripts to play the Event (AkAmbient and AkGameObj). When the game starts, the sound will be loaded from the General SoundBank then posted with reference to the Campfire game object. Should you choose to move the game object at runtime, the sound will follow the game object's position. To verify your integration of the Ambient_Campfire_Play, you should enter Play mode and listen for it. But before this, you should change layouts so you will be able to see the Scene and Game view simultaneously.

  5. In the Unity menu, click Window > Layouts and select 2 by 3.

  6. Click Play.

  7. Use the mouse to rotate the Camera while looking at the 301_Campfire game object.

    Depending on where the camera is located relative to the 301_Campfire game object, the sound's orientation in the soundscape will change. Audibility is based on player position, and does not change based on the position of the Main Camera. The camera position, however, defines the listener direction and therefore affects things like panning.

  8. Press P (to show the mouse) and, in the Hierarchy, select the 301_Campfire game object.

    [Tip]

    You can also select the 301_Campfire game object in the Scene view; but, if you do, make sure that you have not selected any of the 301_Campfire game object children instead of the top one with the sound posted on it.

  9. Use the Move tool ('W') to move the Campfire game object away from the Main Camera.

    As the Ambient_Fire_Campfire Sound SFX is using 3D spatialization, and the Ambient_Campfire_play event is posted on the 301_Campfire game object, the game will continually update the sound's position to where you move the game object. Lastly, let's reset the layout to default for the upcoming exercises.

  10. In the Unity menu, click Window > Layouts and choose Default.

Using the Wwise Unity Integration scripts, you can quickly get any Event from Wwise into the game, as long as you have loaded the SoundBank (including that Event) beforehand.


Was this page helpful?