OK, when we started to work on the LeaderboardEntityDisplay, I immediately thought we should be sending the LeaderboardEntityState struct rather than each field independently since we already had that created.
So I did:
public void Initialize(LeaderboardEntityState leaderboard)
{
ClientId = leaderboard.ClientId;
_playerName = leaderboard.PlayerName.ToString();
UpdateCoins(leaderboard.Coins);
}
And then in the LeaderBoard method HandleLeaderboardEntitiesChanged:
LeaderboardEntityDisplay leaderboardEntityDisplay = Instantiate(leaderboardEntityPrefab, leaderboardEntityHolder);
leaderboardEntityDisplay.Initialize(new LeaderboardEntityState
{
ClientId = changeEvent.Value.ClientId,
PlayerName = changeEvent.Value.PlayerName,
Coins = changeEvent.Value.Coins
});
entityDisplays.Add(leaderboardEntityDisplay);
I figured that even though LeaderboardEntityState has the network serlializer, it could still be used. Is this appropriate?
Thanks,
Julian Boardman