Skip to content

Work with Player Names

This how-to updates, retrieves, and looks up player names, and views them in the Web Console.

Prerequisites

Automatic Platform Names

When possible, LootLocker attaches a name to the player when starting a session. This is only possible for platforms where the player already has a name, such as Steam or PlayStation Network.

Platforms Supporting Automatic Names: Steam, PlayStation Network.

If you're using a platform without automatic player names, or want to update the name LootLocker has stored for the player, you can change the name using the SDK or API.

Player names can also be viewed in the Web Console:

Players with names in the web console

Unique Player Names

To ensure no two players in your game have the same name, use the Unique Player Names setting in your game settings. Enabling this toggle returns an error when updating a player's name if that name is already taken.

Update Player Name in Game

LootLockerSDKManager.SetPlayerName("Some other name", (response) =>
{
if (response.success)
{
Debug.Log("Successfully set player name");
} else
{
Debug.Log("Error setting player name");
}
});

Retrieve Player Name in Game

LootLockerSDKManager.GetPlayerName((response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved player name: " + response.name);
} else
{
Debug.Log("Error getting player name");
}
});

Lookup Multiple Player Names Using Player IDs

ulong player1ID = 1;
ulong player2ID = 2;
ulong player3ID = 3;
LootLockerSDKManager.LookupPlayerNamesByPlayerIds(new ulong[] { player1ID, player2ID, player3ID }, response =>
{
if (response.success)
{
foreach (var player in response.players)
{
Debug.Log(player.player_id);
Debug.Log(player.player_public_uid);
Debug.Log(player.name);
Debug.Log(player.last_active_platform);
Debug.Log(player.platform_player_id);
}
} else
{
Debug.Log("Error looking up player names");
}
});

Multiple platforms and public UID are also supported:

- LookupPlayerNamesByPlayerPublicUIds(string[] playerPublicUIds, Action onComplete)
- LookupPlayerNamesBySteamIds(ulong[] steamIds, Action onComplete)
- LookupPlayerNamesBySteamIds(string[] steamIds, Action onComplete)
- LookupPlayerNamesByPSNIds(ulong[] psnIds, Action onComplete)
- LookupPlayerNamesByPSNIds(string[] psnIds, Action onComplete)
- LookupPlayerNamesByXboxIds(string[] xboxIds, Action onComplete)

Conclusion

You've updated, retrieved, and looked up player names, and can view them in the Web Console. Next, review LootLocker's full feature set to decide which other features to implement.