버전
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/Deployment/Components/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 extend this partial class.

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 extends AkBasePathGetter. The contents of this file will be like this:
    public partial class AkBasePathGetter
    {
    #if UNTIY_IOS
    static partial void GetCustomPlatformName(ref string platformName)
    {
    switch(UnityEngine.iOS.Device.generation)
    {
    case UnityEngine.iOS.DeviceGeneration.iPodTouch1Gen:
    case UnityEngine.iOS.DeviceGeneration.iPodTouch2Gen:
    case UnityEngine.iOS.DeviceGeneration.iPodTouch3Gen:
    case UnityEngine.iOS.DeviceGeneration.iPodTouch4Gen:
    case UnityEngine.iOS.DeviceGeneration.iPodTouch5Gen:
    case UnityEngine.iOS.DeviceGeneration.iPodTouchUnknown:
    platformName = "iPod";
    break;
    case UnityEngine.iOS.DeviceGeneration.iPad1Gen:
    case UnityEngine.iOS.DeviceGeneration.iPad2Gen:
    case UnityEngine.iOS.DeviceGeneration.iPad3Gen:
    case UnityEngine.iOS.DeviceGeneration.iPadMini1Gen:
    case UnityEngine.iOS.DeviceGeneration.iPad4Gen:
    case UnityEngine.iOS.DeviceGeneration.iPadAir1:
    case UnityEngine.iOS.DeviceGeneration.iPadMini2Gen:
    case UnityEngine.iOS.DeviceGeneration.iPadMini3Gen:
    case UnityEngine.iOS.DeviceGeneration.iPadAir2:
    case UnityEngine.iOS.DeviceGeneration.iPadUnknown:
    platformName = "iPad";
    break;
    case UnityEngine.iOS.DeviceGeneration.iPhone:
    case UnityEngine.iOS.DeviceGeneration.iPhone3G:
    case UnityEngine.iOS.DeviceGeneration.iPhone3GS:
    case UnityEngine.iOS.DeviceGeneration.iPhone4:
    case UnityEngine.iOS.DeviceGeneration.iPhone4S:
    case UnityEngine.iOS.DeviceGeneration.iPhone5:
    case UnityEngine.iOS.DeviceGeneration.iPhone5C:
    case UnityEngine.iOS.DeviceGeneration.iPhone5S:
    case UnityEngine.iOS.DeviceGeneration.iPhone6:
    case UnityEngine.iOS.DeviceGeneration.iPhone6Plus:
    case UnityEngine.iOS.DeviceGeneration.iPhoneUnknown:
    default:
    platformName = "iPhone";
    break;
    }
    }
    #endif
    }
    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:
    public class WwiseIOSBuildPreprocessor : IPreprocessBuild, IPostprocessBuild
    {
    public int callbackOrder { get { return 0; } }
    string iPodDestinationSoundBankFolder = string.Empty;
    string iPadDestinationSoundBankFolder = string.Empty;
    string iPhoneDestinationSoundBankFolder = string.Empty;
    public void OnPreprocessBuild(BuildTarget target, string path)
    {
    if (target == BuildTarget.iOS)
    {
    AkBuildPreprocessor.CopySoundbanks(true, "iPod", iPodDestinationSoundBankFolder);
    AkBuildPreprocessor.CopySoundbanks(true, "iPad", iPadDestinationSoundBankFolder);
    AkBuildPreprocessor.CopySoundbanks(true, "iPhone", iPhoneDestinationSoundBankFolder);
    }
    }
    public void OnPostprocessBuild(BuildTarget target, string path)
    {
    DeleteSoundbanks(iPodDestinationSoundBankFolder);
    DeleteSoundbanks(iPadDestinationSoundBankFolder);
    DeleteSoundbanks(iPhoneDestinationSoundBankFolder);
    }
    }
  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.

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요