版本
menu

游戏引擎集成

本节包含针对特定游戏引擎集成场景的补充说明。

复制 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.

要在构建阶段复制所需的库,请使用 Unity Editor 辅助脚本。该脚本位于 Unity 工程的以下目录中: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 + 1);
pinned.Free();
				

Unreal:

FString utf16_text = 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);
				

在 Mac 上生成 SoundBank

speechEngine 插件不支持 Mac 平台。但若通过 Wwise Unreal/Unity Integration 来生成 SoundBank,将自动为 Mac 生成 SoundBank,而这可能会导致发生错误。因此,建议针对 Mac 以显式方式从工程中弃用所有 speechEngine 元素以避免此类错误。有关详细信息,请参阅从平台中弃用工程元素

针对 iOS 编译 IntegrationDemo 的 speechEngine 页面

要编译 IntegrationDemo 的 speechEngine 插件页面,您需要修改随 Wwise SDK 一并提供的 Xcode 工程。

在 IntegrationDemo Xcode 属性中:

  • General - Frameworks, Libraries and Embedded Content 下:

    • 添加 Applications/Audiokinetic/Wwise[version]/SDK/iOS_Xcode[version]/[configuration]/bin 下找到的所有 vt_[lang]_q22.framework 文件。

  • Build Settings 下:

    • @executable_path/Frameworks 添加到 Runpath Search Paths

    • ../../../iOS_Xcode$(XCODE_VERSION_MAJOR)/Profile$(EFFECTIVE_PLATFORM_NAME)/bin 添加到 Framework Search Paths


此页面对您是否有帮助?

需要技术支持?

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

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

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

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

开始 Wwise 之旅