版本
Wwise Unity Integration Documentation
|
The Unity Addressables system uses AssetBundles to package assets separately from the player. 该系统在 DLC 开发当中特别有用,方便将额外的素材存储到外部服务器上。
If you are new to Addressables, see
Addressables package and Get started with Addressables for essential background information.
The following topics explain how to set up the Wwise Unity Addressables package:
The following sections describe how the Wwise Addressables package works:
Be aware of the following characteristics of the Addressables system:
Wwise Addressables 示例 页面提供有关如何参照代码示例管理 Wwise Addressables 素材的附加信息。
The WwiseBankImporter classes process .bnk
and .wem
files. 此脚本会创建包含所述文件二进制数据的素材。随后,我们的自定义素材后处理程序 WwiseBankPostProcess 会将新素材添加到相应平台的 Addressables 分组。 接着,针对每个平台将 Init SoundBank 添加到其各自的 Addressables 分组。之所以分开添加 Init SoundBank,是因为在发布后对工程实施更改(比如添加新的音频总线)时必须予以更新。 通过将 Init SoundBank 打包到各自的 Addressables 素材包,我们可以最大限度地缩短使用托管服务获取新版素材所需的时间。 若想自定义要将素材添加到哪个 Addressables 分组以及将哪些标签应用于素材,请参阅 Wwise Addressables 示例 页面。
素材后处理程序还会为工程中的每个 SoundBank 创建一个 WwiseAddressableSoundBank。 此素材包含用来将平台名称映射到相应 SoundBank 和流播放媒体素材的词典。
![]() | 注意:
|
在针对 Init SoundBank 创建 WwiseAddressableSoundBank 时,将向场景中的 “WwiseGlobal” GameObject 添加 InitBankHolder 组件。 此组件只是简单地存储 WwiseAddressableSoundBank 以便 AddressableBankManager 轻松找到它。
When using Wwise Addressables, the AkAddressableBankManager handles loading and unloading of SoundBanks into memory. 此类会存储对正在和已经加载的 AddressableSoundBank 的引用,并确保始终最先加载 Init SoundBank。 If an AkEvent is triggered before its SoundBank has finished loading, this class stores the triggered call's parameters and retriggers the event after the SoundBank is loaded.
When a SoundBank is loaded, the SoundBank asset that corresponds to the current platform is loaded using Addressables. After it is loaded, the SoundBank data is pinned and a copy of the memory is loaded into the sound engine with AkUnitySoundEngine.LoadBankMemoryCopy().
When in Play Mode in the Unity editor, the AssetDatabase is used instead of Addressables to load SoundBanks synchronously. 也就是说,只能在构建好的游戏中测试异步加载。
![]() | 备注: | Ensure that you use AkBank to load your SoundBanks instead of manually calling the API. |
WwiseBankReference 类用在 Ak.Wwise.Bank 组件的自定义检视器中。 WwiseBankReference 包含对 WwiseAddressableSoundBank 的硬引用。 在通过 AkAssetUtilities.AddressableBankUpdated 委托创建 WwiseAddressableSoundBank Asset 时,会更新此引用。 若在 WwiseAddressableSoundBank 之后创建 WwiseBankReference ,则将在 SoundBanks 文件夹中搜索与 SoundBank 名称匹配的 WwiseAddressableSoundBank 素材。 序列化的 WwiseBankReference 存储在 Assets\Wwise\ScriptableObjects\SoundBank
下。
![]() | 备注: | 游戏对象直接引用的素材会随该游戏对象一并打包。 AkBank 组件包含对 WwiseBankReference 的硬引用,WwiseBankReference 则包含对对应 WwiseAddressableSoundBank 的硬引用。 若将带有 AkBank 组件的游戏对象放在 Addressables 分组中,则将随之一并打包 WwiseBankReference 和 WwiseAddressableSoundBank(无须显式添加到分组中)。 |
Media files (.wem
) are also handled by the WwiseBankImporter script. WwiseAddressableSoundBank 包含一系列对 SoundBank 关联平台专用流播放媒体素材的引用。 在加载 SoundBank 时会通过 Addressables 加载媒体素材,并将其复制到 the Application.persistentDataPath 文件夹中。 若文件夹中已存在同名文件,则对两者的哈希值进行比对。若两个文件不同,则使用 AssetBundle 中的文件加以覆盖。
\akcautionWhen working with Microsoft consoles, it is important to add the PersistentLocalStorage field to the MicrosoftGame.Config. We recommend at least 1024mb.