Skip to main content
Version: 5.7.0

PostScoreToDynamicLeaderboardUTC

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.

The passed in leaderboard config data is to dynamically create the leaderboard if it does not exist already.

ServiceOperation
leaderboardPOST_SCORE_DYNAMIC
caution

This API is deprecated. Please use PostScoreToDynamicLeaderboardUsingConfig instead.

Method Parameters

ParameterDescription
leaderboardIdThe leaderboard to post to
scoreThe score to post
dataOptional user-defined data to post with the score
leaderboardTypeLeaderboard type
rotationTypeType of rotation
rotationResetDate to next rotate rotation (date in millis UTC)
retainedCountHow many previous rotations to keep

Usage

http://localhost:3000
string leaderboardId = "default";
int score = 10;
string jsonData = "{\"nickname\":\"batman\"}";
var leaderboardType = BrainCloudSocialLeaderboard.SocialLeaderboardType.HIGH_VALUE;
var rotationType = BrainCloudSocialLeaderboard.RotationType.DAILY;
ulong rotationReset = (ulong)TimeUtil.UTCDateTimeToUTCMillis(TimeUtil.LocalTimeToUTCTime(System.DateTime.Now.AddDays(1)));
int retainedCount = 2;
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.PostScoreToDynamicLeaderboardUTC(leaderboardId, score, jsonData, leaderboardType, rotationType, rotationReset, retainedCount, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": null
}