Leave a channel
How to remove a player from a Vivox channel and disconnect from communication.
Read time 1 minuteLast updated 7 months ago
To remove a user from a channel, call with the name of the channel to leave. Alternatively, can be used to leave all channels the user is connected to. The disconnected channel object remains in the list until after the disconnection is successful.
VivoxService.Instance.LeaveChannelAsync(string channelName)VivoxService.Instance.LeaveAllChannelsAsync()VivoxService.Instance.ActiveChannelsThe object is immediately removed from the list if the session is completely disconnected.
The following code is an example of how to perform this operation:
using UnityEngine;using Unity.Services.Vivox;class VivoxBasicsExample : MonoBehaviour{ . . . void LeaveChannel(string channelNameToLeave) { . . . VivoxService.Instance.LeaveChannelAsync(channelNameToLeave); . . . } . . .}