I'm trying to get familiar with PlayFab and Unity. At this point I'm trying to make an API call that is beyond just creating an account, logging in and calling the players username up. I want to pull up the players virtual currency I created called "AU", using the call PlayFabClientAPI.GetPlayerCombinedInfo. I'm confused about how to read and implement the PlayFab documentation. All the examples are written in Json and I've gotten lucky converting them over to C# so far but this GetPlayerCombinedInfo is stumping me. And if I can't figure this out from their example code then I can't get any help from their documentation in the future.
My question is, how do I interpret these json inputs into C#?
https://api.playfab.com/documentation/client/method/GetPlayerCombinedInfo
This is a sample request.
POST https://{ {TitleID}}.playfabapi.com/Client/GetPlayerCombinedInfo Content-Type: application/json X-Authentication: <user_session_ticket_value> {
"PlayFabId": "4027527BF22653D1",
"InfoRequestParameters": {
"GetUserAccountInfo": true,
"GetUserInventory": false,
"GetUserVirtualCurrency": true,
"GetUserData": true,
"UserDataKeys": [
"preferences",
"progress"
],
"GetUserReadOnlyData": false,
"GetCharacterInventories": false
, "GetCharacterList": false,
"GetTitleData": false,
"GetPlayerStatistics": false,
"GetPlayerProfile": false } }
and this is my interpretation of it in C#
var request = new GetPlayerCombinedInfoRequest() {
InfoRequestParameters = {
GetCharacterInventories = false,
GetCharacterList = false,
GetPlayerProfile = false,
GetPlayerStatistics = true,
GetTitleData = false,
GetUserAccountInfo = false,
GetUserData = false,
GetUserInventory = false,
GetUserReadOnlyData = false,
GetUserVirtualCurrency = true
}
};
and here is the call and OnSuccess function (the script doesn't get here before it throws an error)
PlayFabClientAPI.GetPlayerCombinedInfo(request, UpdateGold, OnFailure);
}
void UpdateGold(GetPlayerCombinedInfoResult result)
{
int value = 0;
result.InfoResultPayload.UserVirtualCurrency.TryGetValue("AU", out value);
Debug.Log(value);
gold.text = "Gold: " + value.ToString();
}
this compiles fine and then return a null object error at the first line of code up there, it cant create a request object.
Am I writing the InfoRequestParameters wrong?
Why doesn't the playfab documentation have any examples in c#?
How do I write a correct GetPlayerCombinedInfoRequest call in c#?
var request = new GetPlayerCombinedInfoRequest() { };
I feel like I'm not writing the InfoRequestParameters correctly or something.
Thanks for any help you can offer!