For experimentation purposes, I tried commenting out the list addition in RTSPlayer.OnStartClient:
public override void OnStartClient()
{
if (NetworkServer.active) { return; }
DontDestroyOnLoad(gameObject);
// ((RTSNetworkManager)NetworkManager.singleton).Players.Add(this);
}
With 2 players in the lobby, this is what the host’s screen looks like:
And the non-host player’s screen:
Why doesn’t the host’s screen match the client’s? I thought the host’s RTSPlayer script running on the client would update the player list with ClientHandleDisplayNameUpdated
, but the player name list is still displayed on the host (like it is using the server player list instead of the client).
Also, why isn’t the code in OnStartAuthority
instead of OnStartClient
? I assume OnStartClient
is called on both Player 1 and Player 2’s client when the RTSPlayer component is added to the player GameObject. Will the player be added to the list twice?