so i gave it the old college try, but it always just uses the steam user name of the host. so, in other words, when i host a game, it shows my username as the first person in the lobby. and then when a friend joins it shows that his username is my username as well… but this seems to be a little bit in the right direction.
in RTSNetworkManager i created a new event to listen on
public static event Action<RTSPlayer, string> ServerSetPlayerName;
and then in OnServerAddPlayer, i replaced
player.SetDisplayName($"Player {Players.Count}");
with
ServerSetPlayerName?.Invoke(player, $"Player {Players.Count}");
and then in the MainMenu, in Start, i subscribe with
RTSNetworkManager.ServerSetPlayerName += ServerHandleSetPlayerNameUpdated;
and my ServerHandleSetPlayerNameUpdated method looks like
private void ServerHandleSetPlayerNameUpdated (RTSPlayer player, string serverDisplayName) {
if (useSteam) {
player.SetDisplayName(SteamFriends.GetPersonaName());
return;
}
player.SetDisplayName(serverDisplayName);
}
let me know if you can figure out how to get the proper steam username…