Social
For player identity and registration state, see Player. For the player's username and a sized avatar URL formatted for Unity texture loading, use GetProfile() documented below. It handles size selection and engine-friendly format conversion for you.
Player profile
Each registered user on Jest can set up a profile with a display username and a customizable avatar. JestSDK.Instance.Social.GetProfile(avatarSize) returns both the username and a resized avatar URL. Unity's UnityWebRequestTexture only natively decodes PNG and JPEG, and the underlying avatar file can be WebP, so the helper routes through Cloudflare Image Resizing to return a format Unity can decode at the size that fits your UI.
The avatar is delivered at one of these sizes: 64x64, 128x128, 256x256, 512x512, or 1000x1000 pixels. Request the smallest size that fits your UI for the best performance.
private IEnumerator LoadPlayerProfile(RawImage target, TMPro.TextMeshProUGUI nameLabel)
{
Social.PlayerProfile profile = JestSDK.Instance.Social.GetProfile(128);
if (profile == null) yield break; // guest or no profile set
if (nameLabel != null)
nameLabel.text = profile.Username;
if (profile.AvatarUrl != null)
{
using var request = UnityWebRequestTexture.GetTexture(profile.AvatarUrl);
yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success)
target.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
}
}
Social.GetProfile() returns null for guest players and registered players who haven't set up a profile yet. AvatarUrl may also be null for registered players with no avatar. Always provide a fallback in your UI.
JestSDK.Instance.Social.GetProfile()
public Social.PlayerProfile GetProfile(int avatarSize = 1000);
Parameters:
| Name | Type | Description |
|---|---|---|
avatarSize | int | Optional. One of 64, 128, 256, 512, or 1000. Defaults to 1000. Other values bucket down to the next supported size. |
Returns a Social.PlayerProfile instance, or null when the player has no profile:
public class Social.PlayerProfile
{
public string Username; // The player's display name
public string AvatarUrl; // Cloudflare-proxied PNG/JPEG URL, or null
}
JestSDK.Instance.Social.GetPlayerAvatar() (deprecated)
GetPlayerAvatar() is deprecated. Use GetProfile(avatarSize).AvatarUrl instead, which also provides the player's username in a single call.
[Obsolete("Use GetProfile(avatarSize).AvatarUrl instead.")]
public string GetPlayerAvatar(int size = 1000);
Parameters:
| Name | Type | Description |
|---|---|---|
size | int | Optional. One of 64, 128, 256, 512, or 1000. Defaults to 1000. Other values bucket down to the next supported size. |
Returns:
| Type | Description |
|---|---|
string | A Cloudflare-proxied URL for the current player's avatar, or null when the player has no avatar. PNG/JPEG-decodable. |
Bots
When games need to fill in player slots with bots, we recommend using the bot avatars for this purpose. There are 1000 unique bot avatars, and you can request them using the GetBotAvatar method. They are generated deterministically, so the same username will always return the same avatar.
The avatar is delivered at one of these sizes: 64x64, 128x128, 256x256, 512x512, or 1000x1000 pixels. It is recommended to request the smallest size that fits your UI for best performance, as this will minimize network traffic and improve loading times.
List<(string username, string avatarUrl)> GetBots(IEnumerable<string> usernames)
{
var bots = new List<(string, string)>();
foreach (var username in usernames)
{
bots.Add((username, JestSDK.Instance.Social.GetBotAvatar(username, 128)));
}
return bots;
}
GetBots(new[] { "Hello", "Jest", "Bots" });
| 512x512 | 256x256 | 128x128 | 64x64 |
|---|---|---|---|
JestSDK.Instance.Social.GetBotAvatar()
public string GetBotAvatar(string username, int size = 1000);
Parameters:
| Name | Type | Description |
|---|---|---|
username | string | Required. Used as a seed for the avatar — the same username always returns the same avatar. |
size | int | Optional. One of 64, 128, 256, 512, or 1000. Defaults to 1000. Other values bucket down to the next supported size. |
Returns:
| Type | Description |
|---|---|
string | The URL of the bot avatar. |
The mapping from username to avatar is deterministic and identical across game engines, so the same username yields the same avatar whether your game uses the Unity, Godot, or HTML5 SDK.