- Home /
 
Network - Client still in Network.Connections after disconnect
Hello,
When my clients disconnect (using Network.Disconnet()), my server gets this callback:
     void OnPlayerDisconnected(NetworkPlayer player)
     {
         Network.RemoveRPCs(player);
         PlayerStats.Remove(player);
         LoopConnections();
     } 
 
               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?
Answer by fafase · Jan 16, 2012 at 02:00 PM
You may want to try this http://unity3d.com/support/documentation/ScriptReference/Network.DestroyPlayerObjects.html
Your answer
 
             Follow this Question
Related Questions
Question about Network and NetworkViewID 1 Answer
Question about Network.Destroy 0 Answers
Sending a gameobject over network with RPC? 2 Answers
Run several unity clients at once in windows? 0 Answers
SuperJump and SuperSpeed 2 Answers