Trying to set Initial Player level as 1. But getting error. Need Help!
CLOUD SCRIPTS:
handlers.SetInitialLevel = function(args, context){
var createLevelData = {
PlayerId: currentPlayerId,
Data: {}
}
createLevelData.Data["level"] = 0;
var createLevelResult = server.UpdateUserInternalData(JSON.stringify(createLevelData.Data));
return createLevelResult;
}
//--------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------------------- UNIT C SARP CODE:
void SetPlayerLevel(){
var request = new ExecuteCloudScriptRequest{
FunctionName = "SetInitialLevel"
};
PlayFabClientAPI.ExecuteCloudScript(request, OnLevelCreated, OnError);
}
void OnLevelCreated(ExecuteCloudScriptResult result){
Debug.Log(JsonUtility.ToJson(result));
}
//--------------------------------------------------------------------------------------------------------------------------------------
I am calling this method On Login Success
ERROR
{"APIRequestsIssued":1,"Error":{"Error":"CloudScriptAPIRequestError","Message":"The script called a PlayFab API, which returned an error. See the Error logs for details.","StackTrace":"Error\n at Object.server_request (Script:181:24)\n at server.UpdateUserInternalData (Script:629:79)\n at handlers.SetInitialLevel (C5E75-main.js:9:36)\n at Object.invokeFunction (Script:117:33)"} ,