# チャンネルから退出する

> How to remove a player from a Vivox channel and disconnect from communication.

チャンネルからユーザーを削除するには、退出するチャンネルの名前で [`VivoxService.Instance.LeaveChannelAsync(string channelName)`](https://docs.unity3d.com/Packages/com.unity.services.vivox@latest/index.html?subfolder=/api/Unity.Services.Vivox.IVivoxService.html#Unity_Services_Vivox_IVivoxService_LeaveChannelAsync_System_String_) を呼び出します。別の方法として、`VivoxService.Instance.LeaveAllChannelsAsync()` を使用して、そのユーザーが接続しているすべてのチャンネルから退出することもできます。切断されたチャンネルオブジェクトは、切断が成功するまでの間、`VivoxService.Instance.ActiveChannels` リストに残ります。

セッションが完全に切断されている場合、オブジェクトはリストから即座に削除されます。

> **Note:**
>
> 切断は即時の操作ではなく、完了までに数秒かかる場合があります。切断が正常に完了すると、ChannelLeft イベントがトリガーされます。

以下のコードは、この操作の実行方法の例を示します。

```cs
using UnityEngine;
using Unity.Services.Vivox;

class VivoxBasicsExample : MonoBehaviour
{
    . . .
    void LeaveChannel(string channelNameToLeave)
    {
        . . .
        VivoxService.Instance.LeaveChannelAsync(channelNameToLeave);
        . . .
    }
    . . .
}
```
