Skip to main content
Version: 5.7.0

PostScoreToLeaderboard

Post the players score to the given social leaderboard.

You can optionally send a user-defined json string of data with the posted score. This string could include information relevant to the posted score.

Note that the behavior of posting a score can be modified in the brainCloud portal. By default, the server will only keep the player's best score.

ServiceOperation
leaderboardPOST_SCORE

Method Parameters

ParameterDescription
leaderboardIdThe leaderboard to post to.
scoreThe score to post.
dataOptional user-defined data to post with the score. (As of 5.3, when updating an existing score, if the data argument is null, the currently stored data value will be preserved.)

Usage

http://localhost:3000
string leaderboardId = "default";
int score = 10;
string jsonOtherData = "{\"nickname\":\"batman\"}";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.LeaderboardService.PostScoreToLeaderboard(leaderboardId, score, jsonOtherData, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": null
}