I have written a custom cloud script function to grant items to user when they create an account for the first time.
I call this function from inside the unity sdk a few seconds after account creation(To avoid granting items to an account which is under creation process on the server)
But the function is not granting the item to the user. i've made usre the item spelling is all correct and it even returns a success callback in the SDK
Please Help
Below is the code of the function:
handlers.GrantFirstTimeItems = function(args) { var rewards = "PW-PoorBlaster"; var resultItems = null; if(rewards) { // Grant reward items to player for completing the level var itemGrantResult = server.GrantItemsToUser( { PlayFabId: currentPlayerId, Annotation: "Given by completing level "+levelNum, ItemIds: rewards }); resultItems = itemGrantResult.ItemGrantResults; } return { rewards: resultItems }; };