⬇️ Get player profile

A player profile contains information on a user account that's unrelated to their performance on a leaderboard. If no PlayerId is passed, the current user is returned.

GalaxyClientAPI.GetPlayerProfile(new GalaxySDK.ClientModels.GetPlayerProfileRequest { }, result => { 
    var clan = result.Clan; //Clan object, if the player is in one
    var playerProfile = result.PlayerProfile; //PlayerProfile result
    var notifications = result.Notifications; //# of unread messages in clan
}, error => { });
Player Profile Objects

GetPlayerProfile Response

/// Details for the clan this user is a part of.
public Clan Clan;
/// The profile of the player. This profile is not guaranteed to be up-to-date. For a new player, this profile will not
/// exist.
public PlayerProfileModel PlayerProfile;
/// If the user has notifications, like unread messages in a clan
public int Notifications;

Clan reference

PlayerProfileModel reference

⬇️ Get player avatar

Use the following functions to get and display avatars. If you don't pass a PlayerID, the current player's avatar will be returned.

GalaxyClientAPI.Controller.GetPlayerAvatarTexture((imageTexture) => {
    //Example use for imageTexture
    avatarImage.sprite = Sprite.Create(
        new Rect(0.0f, 0.0f, imageTexture.width, imageTexture.height), 
        Vector2.one * 0.5f);
}, PlayerId); //PlayerId is optional

⬆️ Set nickname

Edit the player's nickname (username). This will have no effect if the user has set their username themselves.

GalaxyClientAPI.UpdatePlayerProfile(new GalaxySDK.ClientModels.UpdatePlayerProfileRequest {
    Nickname = "NewUsername"
}, result => { 
    var playerId = result.PlayerProfile; //PlayerProfile result
}, error => { });

⬆️ Set custom avatar image

This is only available in the Unity SDK for now. Either set Texture or ImageBytes. ImageBytes will take priority over Texture if they are both provided.

This endpoint will return a 400 error if you have not added Custom Avatar Images to your plan

GalaxyClientAPI.SetCustomAvatar(new GalaxySDK.ClientModels.SetCustomAvatarRequest {
    //Set one or the other
    Texture = imageTexture, //imageTexture is of type Texture2D
    ImageBytes = byteArray //byteArray is of type byte[]
}, result => { }, error => { });

Show profile

Directly open a player's profile. If no PlayerId is passed, the current user is shown.

//Show this player's profile

//Show another player's profile
GalaxyClientAPI.Controller.OpenProfile(PlayerId: "player_id", Options: ViewOptions);

Show editor

You can easily show the avatar editor by calling:

//Full screen with close button

↕️ Profile Delegate

Assign the infoDidChange(GalaxySDK.ClientModels.PlayerProfileModel playerProfile) delegate to listen for info updates.

void Start(){
    FindObjectOfType<GalaxyController>().infoDidChange += myInfoDidChangeFunction;

private void myInfoDidChangeFunction(GalaxySDK.ClientModels.PlayerProfileModel playerProfile){
    var newNickname = playerProfile.Nickname;

Last updated