After I downloaded leaderboard data (using the Steamworks.NET API), I couldn't find any related info about the user's name and the avatar picture. The only thing I can get is a CSteamID.

I saw some games implement a Steam Leaderboard, displaying their name and avatar images, and I'm trying to achieve the same thing. However, I've searched on the Steamworks documentation and on Google for almost a day, but couldn't find any related information.

The only thing I found was an API with SteamFriends, there were some API's that retrieved the user's name and avatar image.

Here's the code I'm trying:

private CallResult<LeaderboardScoresDownloaded_t> m_DownloadResult = new CallResult<LeaderboardScoresDownloaded_t>();


SteamAPICall_t hSteamAPICall = SteamUserStats.DownloadLeaderboardEntries(
m_DownloadResult.Set(hSteamAPICall, OnLeaderboardDownloadScore);


void OnLeaderboardDownloadScore(LeaderboardScoresDownloaded_t pCallback, bool failure) {
    Debug.Log("Failure: " + failure);

    if (!failure) {
        int count = pCallback.m_cEntryCount;

        for (int i = 0; i < count; i++) {
            LeaderboardEntry_t leaderboardEntry;

                out leaderboardEntry,

            CSteamID user = leaderboardEntry.m_steamIDUser;

            Debug.Log("Rank" + i);
            Debug.Log("User Name: " + leaderboardEntry.    // how to get user name and avatar?


In LeaderboardEntry, I can only get the score and CSteamID. In SteamUser and SteamUserStat classes, there was no API that can get the user's name and avatar image.

  • \$\begingroup\$ Friend, have you made any progress? I'm in the same dilemma, I'm doing it for the game maker. \$\endgroup\$ Commented Feb 11, 2021 at 1:33
  • \$\begingroup\$ @TiagoMartinelli Answers posts should be used to provide solutions to the question asked. If you have a new question, please use the Ask Question button at the top of the page. \$\endgroup\$
    – Vaillancourt
    Commented Feb 11, 2021 at 1:53

2 Answers 2


You're looking for ISteamFriends.

Code for use with Steamworks.NET's isteamfriends.cs:

public static string GetFriendlyName(CSteamID id)
    return SteamFriends.GetFriendPersonaName(id);

public static Texture2D GetAvatar(CSteamID id)
    // See docs for when this is valid. Also for other sizes.
    int avatar_id = SteamFriends.GetMediumFriendAvatar(id);
    Texture2D avatar = null;
    if (!SteamUtils.GetImageSize(avatar_id, out uint width, out uint height)
            && width > 0
            && height > 0)
        var image = new byte[width * height * 4];
        SteamUtils.GetImageRGBA(avatar_id, image, (int)(width * height * 4));
        avatar = new Texture2D((int)width, (int)height, TextureFormat.RGBA32, false, true);
        // Unity expects texture data to start from "bottom", so avatar
        // will be upside down. You could change the pixels here to fix it.

    return avatar;

But you may want to consider using Facepunch.Steamworks which is more C#-friendly (async/await instead of callbacks, enumerables, etc). From their examples:

foreach ( var friend in SteamFriends.GetFriends() )
    Console.WriteLine( $"{friend.Id}: {friend.Name}" );
    Console.WriteLine( $"{friend.IsOnline} / {friend.SteamLevel}" );

    friend.SendMessage( "Hello Friend" );

var image = await SteamFriends.GetLargeAvatarAsync( steamid );
if ( !image.HasValue ) return DefaultImage;
return MakeTextureFromRGBA( image.Value.Data, image.Value.Width, image.Value.Height );


  • 1
    \$\begingroup\$ This looks like it answers half the question (how to get the username) - can you flesh this out into a more complete example? \$\endgroup\$
    – DMGregory
    Commented Jun 19, 2021 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .