Hello everyone, i have not find the answer of this problem, i have code like this:
void Start() {
if (isServer) {
gameObject.GetComponent<NetworkIdentity>().connectionToClient.RegisterHandler(MsgType.Disconnect, OnDisconnectClient);
gameObject.GetComponent<NetworkIdentity>().connectionToClient.RegisterHandler(MsgType.Connect, OnConnectClient);
}
}
void OnConnectClient(NetworkMessage netMsg) {
p_list.add(login);
}
void OnDisconnectClient(NetworkMessage netMsg) {
if (login.Length > 1) {
p_list.remove(login);
Rpc_addTchat("\n" + login + " has quit !");
}
Destroy(gameObject,0.1f);
}
And, i have make many test but when a player disconnects it sends as many times the disconnection of the first player who has disconnected that there were players who are disconnected at the same time.
When i have player A and player B, if player B and fast after player A disconnect, i have 2 message for the player B.
And player A is not remove (if i delete this code is remove), and is say “the class is destroy” after the first time, but i have already test with out destroy and i say 2 disconnect for 1 same player and the second player, is never say disconnect.
Is that what I misunderstood?