Table of Contents

Wwise Unreal Integration Documentation
Splitting Switch Container Media
Note:
This feature is only available when using Event-Based Packaging
Warning:
This feature relies on having Switch or State Value assets loaded in memory in order to load the appropriate media. The following usages would be problematic:
  • Setting states or switches using strings. If you wish to split Switch Container media, you will need to ensure the corresponding switch or state value asset is loaded, using the Load Asset Blueprint Node, for example.
  • Setting states or switches from C++. If you wish to split Switch Container media, you will need to ensure the corresponding switch or state value asset is loaded, using Asynchronous Asset Loading, for example. If you do not wish to dynamically load assets at runtime, it is recommended to deactivate the Split Switch Container Media feature.

In order to optimize memory usage, the dependencies between an Event and its media take Switch container values into consideration. For example, consider the following Footstep event dependency tree:

If the currently active level only references the Material_Dirt Switch Value (via a SetSwitch node in the Level Blueprint, for example), only the Foot_Dirt1 and Foot_Dirt2 media files are loaded to memory. If at a later time a level referencing Material_Grass is loaded, Foot_Grass1 and Foot_Grass2 are automatically loaded at the same time.

Note that this feature can be disabled in the Integration settings:

How the load and unload of media associated with switch/state value is done

In order to optimize memory usage for events that implement a Switch Container, the Split Switch Container Media Integration Setting is activated by default.

When this option is activated, the switch container tree is replicated in the event asset data. Each switch or state is associated with either children SwitchContainerData or a list of media.

When a state or switch value asset is referenced in a level, every loaded event receives a callback to load or unload media assets associated with this switch or state value, and traverses the whole dependency tree to all the loaded referenced media. When unloading, the handle to the streaming manager is released and the media is removed from memory on the next tick of the garbage collector.

This dependency tree is implemented using AkAssetDataSwitchContainerData:

AkAssetDataSwitchContainerData contains references to media files:

AkAssetDataSwitchContainerData can also contain references to other AkAssetDataSwitchContainerData. This is the case when using nested Switch containers in Wwise.