Documentation

Support

Vivox Unity SDK

Vivox Unity SDK

Leave a channel

How to remove a player from a Vivox channel and disconnect from communication.
Read time 1 minuteLast updated 2 days ago

To remove a user from a channel, call
VivoxService.Instance.LeaveChannelAsync(string channelName)
with the name of the channel to leave. Alternatively,
VivoxService.Instance.LeaveAllChannelsAsync()
can be used to leave all channels the user is connected to. The disconnected channel object remains in the
VivoxService.Instance.ActiveChannels
list until after the disconnection is successful.
The 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); . . . } . . .}