CloseSession
Namespace: SynicSugar.P2P
Class: ConnectHub
public async UniTask<bool> CloseSession(bool destroyManager = true, bool cleanupMemberCountChanged = false, CancellationToken cancelToken = default(CancellationToken))
Description
Stop the packet receiver, close all connections, remove the notify events and destroy ConnectManager object. Then, Host closees and Guest leaves the lobby.
When Host closes Lobby, Guests are automatically kicked out from the Lobby.
destroyManager: If true, destroy NetworkManager after exit lobby.
cleanupMemberCountChanged: Need to call MatchMakeManager.Instance.MatchMakingGUIEvents.LobbyMemberCountChanged(id, false) after exit lobby?
cancelToken: ancel token for this task
using SynicSugar.P2P;
using System.Threading;
using Cysharp.Threading.Tasks;
public class p2pSample {
public async UniTask ConnectHubSample(){
await ConnectHub.Instance.CloseSession();
}
}