How is NetworkManager.Singleton.DisconnectClient working?

Hi,

I try to disconnect player from NetworkManager via “Host player”.
But this method doesn’t give any effect.
What do I wrong or missed?
I use just Relay and NetworkManager (NGO).

Thanks.

Can you post your code?

1 Like

Thank for your answer.
When u ask my code I saw my mistake.
I used to kick player “LocalClientId” instead of “clientId”.
Actually When I used HostId to kick player, Unity didn’t send any error message.
There isn’t any issue now. :slight_smile:

I got new question about NetworkManager.Singleton.DisconnectClient.
Why OnClientDisconnectCallback doesn’t trigger on the Host when Host kicks a player?
And Kicked player’s OnClientDisconnectCallback method’s “ulong disconnectedClientId” parameter returns to zero. This is Host playerId, not disconnected playerId. This value should be KickedPlayerId?

I have understood that event is like “On-This-ClientDisconnect”. If you want observe state of other clients I think good place to look is to relay player prefabs which are spawned and despawned for all existing clients.

Don’t know about your latter question.