I have a Network Lobby Manager with one overridden function. This code applies the color to the gameobject of each players, having their unique color as result.
public class LobbyManager : NetworkLobbyManager {
public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer)
{
LobbyPlayerSettings lobbySettings = lobbyPlayer.GetComponent<LobbyPlayerSettings>();
SpriteRenderer renderer = gamePlayer.GetComponent<SpriteRenderer>();
renderer.color = lobbySettings.playerColor;
return true;
}
}
My problem is that the clients don’t see this color changes. In the host game each player has the correct color (host and clients) thus the OnLobbyServerSceneLoadedForPlayer function is indeed called for every player. But the clients see the default object colors, even on their own objects. Somehow these settings are not passed to the clients.
I don’t do any synchronization with the SpriteRenderer component but after reading some documentation and forum post I don’t think I have to. I’m not even sure how could I synchronize the renderers color setting.
But then what else can be wrong? Is there something else that must be done?