离开频道
How to remove a player from a Vivox channel and disconnect from communication.
阅读时间1 分钟最后更新于 7 个月前
若要从频道中移除用户,请调用 并指定要离开的频道的名称。或者,也可使用 表示离开用户连接的所有频道。已断开连接的频道对象仍位于 列表中,直到成功断开连接之后。
VivoxService.Instance.LeaveChannelAsync(string channelName)VivoxService.Instance.LeaveAllChannelsAsync()VivoxService.Instance.ActiveChannels如果会话完全断开连接,则会立即从列表中移除对象。
以下代码示例说明如何执行此操作:
using UnityEngine;using Unity.Services.Vivox;class VivoxBasicsExample : MonoBehaviour{ . . . void LeaveChannel(string channelNameToLeave) { . . . VivoxService.Instance.LeaveChannelAsync(channelNameToLeave); . . . } . . .}