Leçon 5

Table des matières

Game Parameters

While Switches work on a game object basis and States on a global basis, Game Parameters can be used in both contexts. As described in the previous section, Setting Game Parameters using Wwise-Types, when you have declared a Game Parameter property, you can choose to either use the SetValue() or SetGlobalValue() functions. For the sake of demonstration, let's look at how the Enemy_EvilHead_MovementSpeed Game Parameter is used on a game object basis with each Evil Head.

  1. In Unity, go to Audiokinetic > Certification > 301 > Lesson 5 and select Understanding Global and Game Object Scope

    In this scene, the Adventurer will be surrounded by three Evil Heads. When one of these Evil Heads tries to attack the Player, it performs a sequence of actions. First, they will look and rotate towards the Adventurer, telegraphing that they are about to attack. Then they will charge towards the Adventurer and, upon colliding with the Adventurer, they will bite. Each of these actions is represented by an informative sound, such that a Player wouldn't even have to see them. In addition, a hover sound will be looping to give the listener a constant indication of where an Evil Head is in relation to the Main Camera. As a somewhat concealed audio cue, the EvilHead_Hover_LP Sound SFX has a Wwise Tremolo Effect, which has its frequency mapped using an RTPC to the individual speed of each Evil Head. This is meant to support the Player's intel on the Evil Heads' current behaviors. No matter how many Evil Heads you will be combatting, only one Game Parameter is needed for this. Let's play the game and connect using the Game Object Profiler to better understand how the Game Parameter can be used on a game object basis.

  2. In Wwise, go to Layouts and select Game Object Profiler.

    Before connecting, we should focus the observations on the Evil Heads and the Enemy_EvilHead_MovementSpeed only. In the Game Object Profiler layout's Game Object Explorer, you will be able to view all game objects in the Game Objects tab and choose which game objects you are profiling in the Watches tab.

  3. In the Game Object Explorer, select Watches.

    Each of the three Evil Heads in the Training Area will have the same name. As such, you can simply specify the name they have in common, and the Game Parameter for each Evil Head will appear. If you just completed the previous section you will see a Global Game Object assigned from earlier, so make sure to first remove everything in the list.

  4. Click Clear List.

  5. Click Yes to confirm.

  6. In the Watches tab, click the selector (>>) and select Game Object Name.

  7. In the Watch column, type EvilHead and press Enter.

    Now that you have specified what game objects you were looking at, you need to specify the Game Parameter as well. The Game Sync Watches should be empty.

  8. In the Game Sync Monitor, select any existing elements in the Game Sync Watches and click Remove.

  9. Click Add…

  10. Select the Enemy_EvilHead_MovementSpeed Game Parameter and click OK.

    That's enough preparation for watching the Enemy_EvilHead_MovementSpeed Game Parameter for each Evil Head. Next, let's connect to the game. As we are only testing, let's disable the ability to take damage.

  11. Play the scene, then press ESC to enter the WAG menu and select GOD MODE.

  12. In the Wwise toolbar, click Remote…, highlight the Wwise Adventure Game (Editor) and click Connect.

  13. Avoid the Evil Heads for at least five to ten attacks, but feel free to take a swing at them once in a while.

  14. Exit Play mode, and switch back to Wwise.


Do not run towards the Village! It is protected and the EvilHeads will die when nearing it.

In Wwise, notice that in the Game Object Profiler you will now see three graphs, one for each Evil Head.

Whenever the Evil Head charges, you will see a sharp attack curve indicating an increase in movement. When the Evil Head ceases to charge, the curve will decay until the Evil Head is yet again ready to attack. The sudden abrupt increase in a curve is where the Evil Head was attacked by a weapon and thereby interrupted. As you might notice, the Game Parameter curves for each Game Object are not identical. Rather, they describe the individual behavior of each Evil Head. The Enemy_EvilHead_MovementSpeed Game Parameter is set using the SetValue() function, as can be seen in the following SetMovementSpeed() function.

private void SetMovementSpeed(float speed) {
    MovementRTPC.SetValue(gameObject, speed);

In the above function, you are sending a 'gameObject' and a 'speed' variable to the SetValue() function. The speed variable is what you want to set the Game Parameter to and the gameObject is the game object that the Enemy_EvilHead_Hover Event was posted onto.


When using a Game Parameter on both a global and game object basis, the game object basis (SetValue()) will always override the global (SetGlobalValue()) for the specified game object. Take the Time_of_Day Game Parameter, which is set on a global basis. If another script were to use the SetValue() function on the same game object, such as the Woodlands Ambience, the SetValue() would simply take over and the Woodlands Ambience would only be dependent on that game-object-defined Game Parameter value. Any further changes to the Time_of_Day Game Parameter on a global basis would, therefore, not affect the Woodlands Ambience.