Version

menu_open

Defining the contents and behavior of Switch Containers

Switch Containers allow you to group objects according to the different alternatives that exist within a game. Each alternative is represented in the Switch Container by a Switch or state. For example, a Switch Container can be created for all the different surfaces that a character can walk on. The container might contain Switches for concrete, wood, grass, snow, and any other surface that a character might come across in-game.

Within each Switch/State are the objects related to that particular alternative. For example, all the footstep sounds on concrete would be grouped into the “Concrete” Switch, all the footstep sounds on wood would be grouped into the “Wood” Switch, and so on. When the game calls the Switch Container, Wwise verifies which Switch/State is currently active to determine which container or sound to play.

The following illustration demonstrates what happens when an Event calls a Switch Container called “Footsteps”. This container has grouped the sounds according to the different surfaces a character can walk on in game. In this example, there are two Switches: Grass and Concrete. When the Event calls the Switch Container, the character is walking on grass (Switch=Grass), so the footstep sounds on grass are played. A Random Container is used to group the footstep sounds within the Switch so that a different sound is played each time the character steps on the same surface.

Defining the type of Switch Containers

When creating a Switch Container, you must decide whether the container will be based on states, Switches, or RTPCs. While you can select the Switch or state options in the Switch Container Property Editor, RTPCs are linked to Switch Groups in the Switch Group Property Editor. For more information on how RTPCs can be associated with Switches, refer to Mapping Game Parameter values to Switches.

After determining the Switch type, you must also assign a Switch or State Group to the container. This defines the Switches/States/RTPCs to which objects can be assigned.

Before you can assign a State or Switch Group to the container, or use RTPCs for Switches, you must create them first. For information on creating Switch Groups, State Groups, and RTPCs, refer to:

To define the type of a Switch Container:

  1. Load a Switch Container into the Property Editor.

  2. In the Switch Type group, select one of the following options:

    • Switch to base the container on game switches.

    • State to base the container on game states.

  3. From the Group list, select the Switch or State Group that you want to assign to the container.

    The Switches/States within that group appear in the Assigned Objects pane of the Contents Editor.

  4. From the Default Switch/State list, select the Switch/State that will be played when the game cannot identify a specific Switch or State.

Defining the playback behavior of Switch Containers

Since Switches or states can change at any point in the game, you need to decide whether the object will change immediately, or only the next time the Switch Container is played. The following play modes are available in Wwise:

  • Step

  • Continuous

You can use the Step option for one-shot sounds, such as footsteps. The Continuous option, on the other hand, is more useful for objects that are continually looping, such as snowboarding sounds.

To define the play mode of a Switch Container:

  1. Load a Switch Container into the Property Editor.

  2. From the Play Mode group, select one of the following options:

    • Step to play a new object only after a new play Event is triggered regardless of whether the Switch changed during playback.

    • Continuous to play a new object as soon as a new Switch/State is detected. When Continuous is selected, a new play Event is not required to change the object that is played.

Adding and removing objects from Switches and States

You must assign the objects within a Switch Container to a particular Switch or State.

You can easily assign objects to switches by adding objects and other containers to the Assigned Objects pane of the Contents Editor. To help speed up the process, you can Ctrl or Shift+click several objects and then add or remove them all at the same time. If you assign several objects to a Switch, they will all be played back simultaneously within Wwise and at runtime in your game.

In most cases, you will assign the objects that are already in the Switch Container, but you might want to drag objects directly from the Audio tab in the Project Explorer to a Switch/State. In this case, the objects are moved from their current location to the Switch Container. If you want to create a copy of the object instead of moving it, you can Ctrl+drag the object from the Audio tab in the Project Explorer to the Switch/State in the Assigned Objects pane.

To assign/remove objects from a Switch/State:

  1. Load a Switch Container into the Property Editor.

    The objects within the container are displayed in the Contents Editor.

  2. To assign an object to a Switch/State, drag an object from the Contents pane to a Switch/State in the Assigned Objects pane.

    The object is added to the Switch/State.

    [Note]Note

    You must drop the object directly on the title of the Switch or state.

  3. To remove an object from a Switch/State, click the object you want to remove in the Assigned Objects pane.

  4. Press the Delete key.

    The object is removed from the State/switch, but still remains in the Contents pane.

Moving objects between Switches or States

If you make a mistake when first assigning an object to a Switch/State or just want to move objects, you can do so at any time.

[Tip]Tip

To move several objects at the same time, Ctrl+click each object and then drag them to the new location.

To move objects between Switches or States:

  1. In the Assigned Objects pane of the Contents Editor, select the object or objects that you want to move.

  2. Drag the object to the new Switch/State.

    The object is now assigned to the new Switch/State.

Defining the playback behaviors of objects within Switch Containers

Since Switches and states can change frequently within a game, you need to determine how each object within the Switch Container will react when the change occurs. You can determine the playback behavior for the following options:

  • Play - Determines whether an object will play each time the Switch Container is triggered or just when a change in Switch/State occurs.

  • Across Switches: Determines whether an object that is in more than one Switch will continue to play when a new Switch/State is triggered.

  • Fade In: Determines whether there will be a fade-in to the new object when a new Switch/State is triggered.

  • Fade Out: Determines whether there will be a fade-out from the existing object when a new Switch/State is triggered.

To define the playback behaviors of objects within a Switch Container:

  1. Load a Switch Container into the Property Editor.

    The objects within the container are displayed in the Contents Editor.

  2. In the Play column, select the 1st only option to play the object only the first time after the Switch/State changes. If you leave the 1st only option unselected, the object will play each time the Switch Container is triggered by the game.

  3. In the Across Switches column, select the Continue to play option to force the object that is in both the source and destination Switches/States to continue playing during a change in Switch/State. If you leave the Continue to play option unselected, the object will stop and will start playing again from the beginning.

    [Note]Note

    The Across Switches option is only available in Continuous play mode.

  4. If you want to fade in to new objects when a change in Switch/State occurs, type the amount of time you want in the Fade-In text box.

    [Note]Note

    The Fade-In option is only available in Continuous play mode.

  5. If you want to fade out from existing objects when a change in Switch/State occurs, type the amount of time you want in the Fade Out text box.


Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise