Network - Client still in Network.Connections after disconnect


When my clients disconnect (using Network.Disconnet()), my server gets this callback:

    void OnPlayerDisconnected(NetworkPlayer player)

In my LoopConnections(), I loop over all connections

    string Score = "";
	foreach (NetworkPlayer player in Network.connections)
		Score += PlayerStats[player].Name + " " + PlayerStats[player].Points + System.Environment.NewLine;

(Playerstats is a dictionary)

For some reason the player that just disconnected is still in the Network.connections array, which gives me a Dictionary-access error (since I removed the entry before loopconnections()). Why is the NetworkPlayer still present?

You may want to try this

Try Network.CloseConnection(player)