Skip to content

Profile Switching

Profile switching lets you change which player is considered the "default" user in the SDK. This is useful if your game UI or logic is focused on one player at a time, but you have multiple authenticated users — similar to classic console or media streaming profile switching.

Use this, for example, when the game is played by only one player at a time locally, but multiple people share the device. At the start of the game session, ask the player to choose a profile (or sign in a new one); once done, all subsequent requests are made on behalf of that player until the game session ends.

Prerequisites

  • Unity, Unreal, or Godot SDK installed and configured in your project (not required for REST).

How It Works

  • The SDK maintains a default user, used for API calls if you don't specify a ULID.
  • You can switch the default user to another authenticated player by their ULID.
  • This doesn't log out or remove any users — it only changes which user is considered default (used in calls to LootLocker when no player ULID is specified).

List Previously Logged-In Users

In a profile switching scenario, you'll likely want to display a profile selection screen at the beginning of the game session. This example lists data about all previous players stored in the SDK.

var cachedPlayerUlids = LootLockerSDKManager.GetCachedPlayerUlids();
foreach (var playerUlid in cachedPlayerUlids)
{
var playerData = LootLockerSDKManager.GetPlayerDataForPlayerWithUlid(playerUlid);
// Replace with your own method to display player profile
DisplayPlayerProfile(playerData.Name, playerData.ULID, playerData.CurrentPlatform.PlatformFriendlyString, playerData.LastSignIn);
}

Select a Profile (Set as Default)

Once the player has selected which profile to use for the current session, set this as the default user in LootLocker.

// Replace with actual player ULID
var selectedPlayerUlid = "selectedPlayerUlid";
if (!LootLockerSDKManager.SetDefaultPlayerUlid(selectedPlayerUlid))
{
Debug.LogError("Failed to set default player ULID.");
}

Conclusion

You can now list previously signed-in players and switch which one is the default user in a multi user context.