-
Followed this guide https://www.youtube.com/watch?v=aPJVhLVEexY&t=126s
-
Now accessing the dictionary to create a scoreboard, this dictionary:
[SyncObject]
public readonly SyncDictionary<NetworkConnection, string> _playerNames = new SyncDictionary<NetworkConnection, string>();
Accessed like so in a seperate script:
private void RefreshScoreboard() //TODO: Clients not 'deteting' other clients leaving.
{
_text.text = "";
foreach (var playerEntry in _playerNameTracker._playerNames)
{
NetworkConnection connection = playerEntry.Key;
string playerName = playerEntry.Value;
_text.text += playerEntry.Value + "\n";
Debug.Log("Connection: " + playerEntry.Key + ", Name: " + playerEntry.Value);
}
Working prefectly except....
On the server, a disconneceted client is removed form the dictionary ✅
On client side, the Debug.Log of a disconnected client shows : Id[-1] and Address [Unset], so they're still in dictionary ❌
How do I ensure this removal of a disconnected client that occurs correctly on the server side also occurs on the client side?
Thanks.