文档

​
​

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
    • Create voice and text channels
      • Channel management
      • Channel name criteria
      • Channel types
      • Positional channels
      • Channel identifiers for large scale games
      • Participant management
      • Join a channel
        • Request capture device access
        • Initiate a channel join
      • Leave a channel
      • Channel webhooks
      • Automatic connection recovery
    • 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 开发者指南
  3. 频道

发起频道加入

How to initiate a channel join request in Vivox.
阅读时间2 分钟
最后更新于 8 个月前

以下代码示例说明如何发起频道加入:
using System;using System.ComponentModel;using UnityEngine;using Unity.Services.Vivox;class JoinChannelExample : MonoBehaviour{ // For this example, _loginSession is a signed in ILoginSession. . . . void OnLoggedIn() { //These events can be bound anywhere, but keeping them within the lifecycle of an active LoginSession is typically best VivoxService.Instance.ChannelJoined += OnChannelJoined VivoxService.Instance.ChannelLeft += OnChannelLeft } void OnChannelJoined(string channelName) { //Perform actions to react to joining the specific channel with name channelName //UI switches, participant UI setup, etc } void OnChannelLeft(string channelName) { //Perform cleanup to react to leaving a specific channel with name channelName } async void JoinChannelAsync(string channelName) { //Join channel with name channelName and capability for text and audio transmission VivoxService.Instance.JoinGroupChannelAsync(channelName, ChatCapability.TextAndAudio); } . . .}
要确定何时加入频道,必须绑定
VivoxService.Instance.ChannelJoined
事件。这个事件本身将使用频道名称进行触发;应使用此名称触发该频道所需的特定事件。建议对频道名称使用某种结构,以便区分不同频道的处理方式。
ChannelLeft
是一个将在离开频道时触发的操作,以离开的频道名称作为参数。
VivoxService.Instance.JoinGroupChannelAsync
、
VivoxService.Instance.JoinEchoChannelAsync
和
VivoxService.Instance.JoinPositionalChannelAsync
有一个名为 ChannelOptions 的可选参数。使用 ChannelOptions 可以设置行为,例如将频道设置为在频道加入完成时要传输到的活动频道。

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

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

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


    报告此页面的问题