#Update metadata in Leaderboards from cloud code C# module

1 messages ยท Page 1 of 1 (latest)

little kraken
#

Hey all, thanks for helping and let me know if you need more information ๐Ÿ™Œ๐Ÿป

Unity Version: 6000.1.3
Leaderboards version: 2.3.3

Original use case: Show steam name as player name in leaderboard.
Original issue: Steam names are not compatible with unity player names (e.g., no space allowed)

Note: I am using SteamFriends.GetPersonaName() as the steam name.

Current use case: Provide steam name as is in metadata for each score added. Scores are updated from within cloud code c# module
Current issue: gameApiClient.Leaderboards provides only one method to add a score AddLeaderboardPlayerScoreAsync and this method does not allow to provide metadata, here is its signature:

Task<ApiResponse<LeaderboardEntryWithUpdatedTime>> AddLeaderboardPlayerScoreAsync(
    IExecutionContext executionContext,
    string accessToken,
    Guid projectId,
    string leaderboardId,
    string playerId,
    LeaderboardScore? leaderboardScore = null,
    CancellationToken cancellationToken = default (CancellationToken));

Navigating to LeaderboardScore makes clear it only takes a score and no metadata; its only data member is Score. For additional info about my research pls consider the thread.

Questions:

  1. is there a way to provide metadata when adding a leaderboard player score from within cloud code?
  2. What is the recommended way to show steam names in a leaderboard, considering that unity's playername doesn't accept all steam names (e.g., no space allowed)?
#

The class LeaderboardScore is in the namespace Unity.Services.Leaderboards.Model
This namespace I could not find in the documentation. (I did find Unity.Services.Leaderboards.Models - in which I cannot find any plain LeaderboardScore. Note the additional suffix "s" in the namespace.).
However, I did find a class with the same name here but this takes additional constructor parameters for the metadata, which my decomlied class does not have!

hybrid viper
#

I use Unity Player Names and replace spaces with underscores.

But yea, using the Cloud Services Apis to AddLeaderboardPlayerScore() you would create a new AddLeaderboardScore that contains your metadata.

little kraken
#

I ended up with the same solution but using dashes. Thanks for the answer!