Version

menu_open
Wwise Unity Integration Documentation
Using Wwise Custom Platforms in Unity

By default, the Wwise Unity Integration assumes the platforms defined in the associated Wwise project all have the default name. If you wish to give your platforms a custom name or define multiple custom platforms for a base platform, you will need to create a C# script to handle this.

Note:This page assumes that the subfolder in which your SoundBanks are generated has the same name as your platform. If this is not the case, note that the string returned by the GetPlatformName method is actually used as the in-game SoundBank subfolder name.

Custom platforms

The default platform resolving script can be found in the file <UNITY_PROJECT_ROOT>/Assets/Wwise/API/Runtime/Handwritten/Common/AkBasePathGetter.cs. As seen in the GetPlatformName() method, default names for all platforms are returned by this function. If you wish to use your own platform names, you will have to register a method to the GetCustomPlatformName delegate. It is recommended to use a static method called through the RuntimeInitializeOnLoadMethod attribute to register to the delegate.

Example

This example will only cover a use case for the iOS platform. In the example, you wish to have three different custom platforms for the iOS base platform: one for iPods, one for iPhones, and one for iPads.

  1. First, in the Wwise project, you will add three different platforms in the platform manager: "iPod", "iPhone", and "iPad". (For more information on the Platform Manager in Wwise, see the Wwise Help > Setting Up Your Projects > Managing Platforms section of the Wwise documentation).
  2. Then, in Unity, create a C# script that registers to the GetCustomPlatformName delegate. The contents of this file should be as follows:
    Note:If platformName is left unmodified, the default platform name for the current active Unity platform will be used.
  3. Either, (a) create a C# that extends AkBuildPreprocessor or (b) create a C# script that uses the functionality within AkBuildPreprocessor. The contents of the file could be as follows:
  4. Or in Wwise, generate the SoundBanks for all three platforms "iPhone", "iPod", and "iPad", and copy the three resulting folders to UNITY_PROJECT_ROOT/Assets/StreamingAssets/Audio/GeneratedSoundBanks.
  5. In Unity, build your game for the iOS platform.
  6. From now on, a different set of SoundBanks will be used depending on the type of device used.

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