PlaytoliaSession provides the current player’s profile. It syncs automatically after login and on profile changes.
Getting the current user
User user = PlaytoliaSession.GetUser();
if (user == null) return; // not logged in
Debug.Log(user.Username);
Debug.Log(user.PlayerId);
Debug.Log(user.Email);
User fields: Uid, PlayerId, Username, DisplayName, Email, Avatar (URL), Lang, Location, Timezone, CreatedAt
GetUser() returns null until the player is authenticated.
Listening to session changes
void Start()
{
PlaytoliaSession.AddListener(OnSessionChanged);
}
void OnSessionChanged()
{
User user = PlaytoliaSession.GetUser();
usernameText.text = user?.Username ?? "Guest";
}
void OnDestroy() => PlaytoliaSession.RemoveListener(OnSessionChanged);
Updating profile
PlaytoliaSession.UpdateUsername("newUsername");
PlaytoliaSession.UpdateDisplayName("Display Name");
PlaytoliaSession.UpdatePassword("oldPass", "newPass");
Profile updates are fire-and-forget. Listen to session state changes to confirm the update was applied.