Version
Wwise Unity Integration Documentation
|
Unity Addressables is a system built around AssetBundles for the purpose of packaging assets separately from the player. This is particularily useful in the context of DLC, where the extra assets can be stored on an external server.
If you are just starting out with Addressables, we recommend first familiarizing yourself with the official documentation and educational resources.
To get setup with the Wwise Unity Addressables package, we recommend starting here:
The following sections will describe how the Wwise Addressables package functions:
The Addressables system has the following particularities of which you should be aware:
The Wwise Addressable Samples page provides additional information about code samples designed to help manage Wwise addressable assets.
When created, .bnk and .wem files are processed by the WwiseBankImporter and WwiseStreamingAssetImporter classes. This script creates assets containing the binary data of the files. Our custom asset postprocessor WwiseBankPostProcess then adds the new assets to the Addressables group of their respective platform. The Init SoundBank for each platform is added to its own Addressables group. The reason the Init Bank is kept separate is because it must be updated when modifications to the project (such as adding new audio busses) are made post-release. By packaging the Init SoundBank in its own addressable AssetBundle, we minimize the time it will take to fetch the new version of this asset from the hosting service. If you wish to customize what addressable group the assets are added to, and which labels are applied to the assets, please consult the Wwise Addressable Samples page.
The asset postprocessor also creates a WwiseAddressableSoundBank for each SoundBank in the project. This asset contains a dictionary that maps platform names to their respective SoundBank and streaming media assets.
Caution: SoundBanks and streaming media referenced in the WwiseAddressableSoundBank are soft references. They will be loaded using Addressables and must be packaged in an Addressables group. |
Caution: If you delete a WwiseAddressableSoundBank by mistake, you will have to delete and regenerate the SoundBanks it is associated with in order to create a new one and set up its references properly. |
When the WwiseAddressableSoundBank for the Init SoundBank is created, an InitBankHolder component will be added to the WwiseGlobal gameobject in the scene. This component simply stores the WwiseAddressableSoundBank so that the AddressableBankManager can find it easily.
When using Wwise Addressables, the loading and unloading of soundbanks into memory is handled by the AkAddressableBankManager. This class stores references to loading and loaded AddressableSoundBanks and ensures that the Init SoundBank is always loaded first. If an AkEvent is triggered before its SoundBank has finished loading, this class will store the triggered call's parameters and retrigger the event once the SoundBank is loaded.
When a SoundBank is loaded, the SoundBank asset corresponding to the current platform is loaded using Addressables. Once it has been loaded, the soundbank data is pinned and a copy of the memory is loaded into the soundengine using AkSoundEngine.LoadBankMemoryCopy().
When in play mode in the editor, the AssetDatabase is used instead of addressables to load SounBanks synchronously. Asynchronous loading can only be tested in the built game.
The WwiseBankReference class is used in our custom inspector for the Ak.Wwise.Bank component. The WwiseBankReference contains a hard reference to a WwiseAddressableSoundBank. This reference is updated when a WwiseAddressableSoundBank Asset is created via the AkAssetUtilities.AddressableBankUpdated delegate. If the WwiseBankReference is created after the WwiseAddressableSoundBank, it will search in the SoundBanks folder for a WwiseAddressableSoundBank asset matching its bank name. Serialized WwiseBankReferences are stored in Assets\Wwise\ScriptableObjects\SoundBank
.
Note: | Any assets that are referenced directly by a game object will be packaged with the game object. AkBank Components contain a hard reference to a WwiseBankReference, and the WwiseBankReference contains a hard reference to its corresponding WwiseAddressableSoundBank. If you put a GameObject with an AkBank component in an Addressables group, the WwiseBankReference and WwiseAddressableSoundBank will be packaged with it (without having to explicitly add them to the group). |
Streaming media (.wem files) are also handled by the WwiseBankImporter script. The WwiseAddressableSoundBank contains a list of references to the platform specific streaming media assets associated with the bank. When a bank is loaded, the media assets are loaded via Addressables and copied to the Application.persistentDataPath folder. If a file with the same name already exists in the folder, their hashes are compared. If the files differ, the file is overwritten by the one from the AssetBundle.
Questions? Problems? Need more info? Contact us, and we can help!
Visit our Support pageRegister your project and we'll help you get started with no strings attached!
Get started with Wwise