I am trying to grant an item to a user (non- purchase) in a Unity3D game. I see the GrantItemsToUsers in the docs but I dont see it in the API.
Is this possible? If not, what is the best way to give a user an inventory item?
I am trying to grant an item to a user (non- purchase) in a Unity3D game. I see the GrantItemsToUsers in the docs but I dont see it in the API.
Is this possible? If not, what is the best way to give a user an inventory item?
There are two possible API calls you may be looking for:
https://api.playfab.com/documentation/server/method/GrantItemsToUser
https://api.playfab.com/documentation/server/method/GrantItemsToUsers
Can you check to make sure you've enabled the Server API in your project?
@Brendan Thanks, I added the Server API and now can see the Grant item code. However, I am getting an invalid parameter when using this Unity code:
publicvoidGrantItem(string itemType)
{
varrequest=newGrantItemsToUsersRequest();
request.ItemGrants=newList<ItemGrant>();
request.ItemGrants.Add(newItemGrant{PlayFabId = UserInfo.PlayerData.id});
request.ItemGrants.Add(newItemGrant{ItemId =itemType});
PlayFabServerAPI.GrantItemsToUsers(request,LogSuccess,LogFailure);
}
Am I not building the list correct?
2 People are following this question.