The default way to support DLCs with Wwise is to use file packages. This is explained in part in the Authoring documentation: Wwise > Help > Finishing Your Project > Managing File Packages > Downloadable Content Overview. The short explanation is that these packages can contain BNK and WEM replacement or additional files, and they can be loaded and unloaded at will to enable or disable the DLC. This package format is optional, but it is currently built-in the Wwise/Unity plug-in. If you want to write your own package format, you'll need to write a new Low-Level IO to replace the default one.
To use packages in Unity, you simply have to place them in the Base Path, the path where your banks are, as defined in AkInitializer's properties. Then call
AkSoundEngine.LoadFilePackage(). Wwise will always try to load files through the file packages first, in the reverse order (last added is the first searched).
This method will work on all platforms that allow you to write on disk, into your Base Path, after the game is shipped. This is unfortunately not the case with iOS and Android.
On Android and iOS, since all the data is bundled into a read-only file system, you will need to put your packages in a different directory. This is done by calling
AkSoundEngine.AddBasePath(), before AkSoundEngine.LoadFilePackage(). You can add multiple paths, the last added will be searched first. Please check the appropriate Operating System documentation to find what are the restrictions. The code below is an example of code to select a path where you can store your files:
#if UNITY_IPHONE string fileNameBase = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/')); fileName = fileNameBase.Substring(0, fileNameBase.LastIndexOf('/')) + "/Documents/" + FILE_NAME; #elif UNITY_ANDROID fileName = Application.persistentDataPath + "/" + FILE_NAME ; #else fileName = Application.dataPath + "/" + FILE_NAME; #endif
Note that there are several other writable paths on Android, such as the SD card or similar storage devices.
- See also:
It is also possible to use the WWW class from Unity to get your DLC audio files and load them directly. This is done through in-memory loading of banks, as demonstrated in AkMemBankLoader.cs. If you are replacing existing banks with new ones, you must take care of properly unloading the previous banks first; the Wwise IO system would be unaware that code so it can't know if you're reloading the same bank by mistake or want to replace it.
Generated on Mon Jan 8 10:46:14 2018 for Wwise Unity Integration by 1.6.3