How to get player names of players in a Unity Lobby?

I know I can access the local player’s name and ID by using AuthenticationService.Instance.GetPlayerNameAsync() but I am unable to get the player names of any other players that join the lobby.
Does it have something to do with using anonymous sign in? Do I need to use a separate service to communicate player names like Relay?

When LobbyEventCallbacks.LobbyChanged callback is triggered, the ILobbyChanges object contains a list of all the players that join the lobby, however, all the values in the object are null except for the player ID and there is no SDK function that allows me to get a player name from an ID.

UPDATE:

I figured out a workaround by using UpdatePlayerOptions to update player data with LobbyService.Instance.UpdatePlayerAsync in order to create a custom PlayerDataObject with key “playerName”

I just wish there was better functionality to get the player name data from the Lobbies.Models.Player.Profile

1 Like