Skip to main content
Version: 5.7.0

IncrementUserStats

Atomically increment (or decrement) user statistics. User statistics are defined through the brainCloud portal.

StatisticsData like

{ "stat1" : 10, "stat2" : -5.5 }

would increment stat1 by 10 and decrement stat2 by 5.5. For the full statistics grammar see the statistics grammar section.

There are many more complex operations supported such as

{ "stat1" : "INC_TO_LIMIT#9#30" }

which increments stat1 by 9 up to a limit of 30.

ServiceOperation
playerStatisticsUPDATE

Method Parameters

ParameterDescription
statisticsThe data to be passed to method

Usage

http://localhost:3000
string statistics = "{\"LIVES\":1}";
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.PlayerStatisticsService.IncrementUserStats(statistics, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"experiencePoints": 2,
"xpCapped": false,
"rewardDetails": {},
"rewards": {},
"experienceLevel": 0,
"statistics": {
"LIVES": 8
},
"currency": {}
}
}