fix: Remove RoomPlayer from roomSlots on Disconnect

This commit is contained in:
Chris Langsenkamp 2020-04-20 11:02:45 -04:00
parent 055a264660
commit 2a2f76c263

View File

@ -247,10 +247,17 @@ public override void OnServerDisconnect(NetworkConnection conn)
{ {
if (conn.identity != null) if (conn.identity != null)
{ {
NetworkRoomPlayer player = conn.identity.GetComponent<NetworkRoomPlayer>(); NetworkRoomPlayer roomPlayer = conn.identity.GetComponent<NetworkRoomPlayer>();
if (player != null) if (roomPlayer != null)
roomSlots.Remove(player); roomSlots.Remove(roomPlayer);
foreach (NetworkIdentity clientOwnedObject in conn.clientOwnedObjects)
{
roomPlayer = clientOwnedObject.GetComponent<NetworkRoomPlayer>();
if (roomPlayer != null)
roomSlots.Remove(roomPlayer);
}
} }
allPlayersReady = false; allPlayersReady = false;