版本
menu

警告:某些受保护的信息未予显示。
若为特定平台授权用户,请确保登录相应的帐户。

Game Engine Integration

This section includes additional instructions for certain game engine integration scenarios.

Copying libraries for the Unity Integration

In addition to the speechEngine plug-in library, voices dynamic libraries are required at runtime such as vt_eng.dll or vt_fre.dll for English and French on Windows.

To copy the required libraries during the build phase, use the Unity Editor helper script located in the following directory in the Unity project: SDK/Plugins/speechEngine/Unity/Editor/SpeechEnginePluginImporterScript.cs

Converting character encoding to UTF-8

Any text you send at runtime must use UTF-8 character encoding. Depending on the platform, you might have to convert text from a different type of encoding to UTF-8. The following code samples for Unity and Unreal demonstrate how to convert UTF-16 encoding (the default on Windows) to UTF-8. You might have to modify the code for other platforms depending on the type of encoding they use.

Unity:

public byte[] ConvertUtf16ToUtf8Bytes(string utf16String)
{
	// Get the UTF-8 encoding
	Encoding utf8 = Encoding.UTF8;

	// Convert the UTF-16 string to a UTF-8 byte array
	byte[] utf8Bytes = utf8.GetBytes(utf16String);

	return utf8Bytes;
}

byte[] textArray = ConvertUtf16ToUtf8Bytes(Text);
System.Runtime.InteropServices.GCHandle pinned = System.Runtime.InteropServices.GCHandle.Alloc(textArray, System.Runtime.InteropServices.GCHandleType.Pinned);
IntPtr address = pinned.AddrOfPinnedObject();
AkUnitySoundEngine.SendPluginCustomGameData(0, this.gameObject, AkPluginType.AkPluginTypeSource, 312, 1, address, (uint)textArray.Length);
pinned.Free();
				

Unreal:

FString utf16_text = "This is a UTF-16 string at its core.";
FStringView fStringView(utf16_text);
auto ConvertedTemp = StringCast<UTF8CHAR>(fStringView.GetData(), fStringView.Len());
auto utf8_text = ConvertedTemp.Get();
SoundEngine->SendPluginCustomGameData(0, 100, AkPluginTypeSource, 312, 1, utf8_text, ConvertedTemp.Length() + 1);
				

SoundBank Generation on Mac

The speechEngine plug-in does not support the Mac platform. However, if you generate SoundBanks through the Wwise Unreal or Unity Integration, SoundBanks are automatically generated for Mac, which can cause errors. Therefore, we recommend that you explicitly exclude all speechEngine elements from your Wwise project for Mac to avoid such errors. See Excluding project elements from a platform for more information.

Compiling the speechEngine IntegrationDemo page for iOS

To compile the speechEngine plug-in page of the IntegrationDemo, you need to modify the Xcode project included with the Wwise SDK.

In the IntegrationDemo Xcode properties:

  • Under General - Frameworks, Libraries and Embedded Content:

    • Add all the vt_[lang]_q22.framework files found under Applications/Audiokinetic/Wwise[version]/SDK/iOS_Xcode[version]/[configuration]/bin.

  • Under Build Settings:

    • Add @executable_path/Frameworks to Runpath Search Paths.

    • Add ../../../iOS_Xcode$(XCODE_VERSION_MAJOR)/Profile$(EFFECTIVE_PLATFORM_NAME)/bin to Framework Search Paths.


此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅