question

Joe Hopkins avatar image
Joe Hopkins asked

GetPlayerCombinedInfo not returning InfoResultPayload.UserVirtualCurrency

I am successfully calling GetPlayerCombinedInfo, but it is not returning InfoResultPayload.UserVirtualCurrency.

Below is our code:

public void GetPlayerCombinedInfo() {

 GetPlayerCombinedInfoRequest request = new GetPlayerCombinedInfoRequest(){
 PlayFabId = this.PlayFabId,

 InfoRequestParameters = new GetPlayerCombinedInfoRequestParams(){

 GetUserAccountInfo = true,
 GetUserInventory = true,
 GetUserVirtualCurrency = true,
 GetUserData = true,
 GetUserReadOnlyData = true,
 GetCharacterInventories = true,
 GetTitleData = true,
 GetPlayerStatistics = true

 }
 };

 PlayFabClientAPI.GetPlayerCombinedInfo (request, (result) => {
 if (result.InfoResultPayload == null)
 {
 Debug.Log("No result!");

 } else if (result.InfoResultPayload.UserVirtualCurrency == null) {

 Debug.Log ("UserVirtualCurrency missing for PlayFabID: " + result.InfoResultPayload.AccountInfo.PlayFabId);

 
 } else {
 foreach (var item in result.InfoResultPayload.UserVirtualCurrency)
 {
 Debug.Log(" " + item.Key + " =================== " + item.Value);
 }
 }
 }, (error) => {
 Debug.Log("Got error retrieving user data:");
 Debug.Log(error.ErrorMessage);
 }, null);
 }

Attached is the dashboard showing that the user has virtual currency and also attached is the debug output showing the correct PlayFabID is returned.

What are we missing?

Thanks,

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

When you make the call by passing in a PlayFab ID, the code assumes you're looking at another player, and VC balances are not returned to other players' Client calls, since that's sensitive info. To query the local player's info, don't specify a PlayFab ID and it will get the info for the local player. I'll open a work item to have the code check the case where the ID specified is that of the local player.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Joe Hopkins avatar image Joe Hopkins commented ·

Thank you that was the solution.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.