文档

​
​

Development

User Acquisition

Monetization

工业

Vivox Unity SDK

Vivox Unity SDK

Vivox
​
​
Vivox Unity SDK
  • Overview
  • Get started
  • Release notes
  • Developer guide
    • Set up your project
      • Integration with the Vivox Unity SDK
      • Initialize the SDK
        • Sign in with the Authentication package
        • Sign in with Custom IDs
        • Using Vivox Access Tokens together with UAS
      • Sign in to a game
      • Sign out of a game
    • Create voice and text channels
    • Messaging
    • Player management
    • Device management
    • Audio management
    • Mobile development
    • Text-to-speech
    • Speech-to-text
    • Real-time recording
    • Server-side-recording
    • Troubleshooting
  • Tutorials
  • Reference
  1. Vivox Unity SDK 文档
  2. Vivox Unity 开发者指南

初始化语音客户端对象

How to initialize the Vivox voice client object.
阅读时间2 分钟
最后更新于 8 个月前

必须先创建并初始化语音客户端,然后才能执行其他 Vivox SDK 操作。在语音客户端初始化过程中,Vivox SDK 会设置并启动其所有不同的子系统。这可能会导致加载其他共享库,使开发者可以在连接到 Vivox 服务之前自定义各种 Vivox SDK 选项。例如,开发者可以在可用编解码器、音频互切设置与日志记录级别之间进行选择。
await VivoxService.Instance.InitializeAsync(VivoxConfigurationOptions config)
具有可以用于选择 Vivox Core SDK 配置的可选参数。
以下代码示例说明如何在 Windows、macOS、Android 和 iOS 上创建和初始化语音客户端:
using System;using UnityEngine;using Unity.Services.Authentication;using Unity.Services.Core;using Unity.Services.Vivox;async void Start(){ await UnityServices.InitializeAsync(); await AuthenticationService.Instance.SignInAnonymouslyAsync(); await VivoxService.Instance.InitializeAsync();}
**重要信息:**如果客户端已初始化,而应用程序尝试再次初始化客户端,则它会遇到
5041:VxErrorAlreadyInitialized
错误。如需了解此错误,请参阅 Vivox SDK 错误代码。
如需了解有关 Unity Authentication 服务的更多详细信息,请参阅使用 Authenticaiton 包进行登录。如需了解其他身份验证方法,请参阅使用自定义 ID 登录,或者如果您已在应用程序中使用 Vivox 访问令牌,请参阅 VAT 与 UAS 结合使用。

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。


    报告此页面的问题