question

betterealm avatar image
betterealm asked

PlayFabClientAPI.GetUserData returns empty result

I'm using PlayFabClientAPI.GetUserData with the logged in user's PlayFabID but the result I get in return is an empty GetUserDataResult object.

Am I missing something in the request? PlayFabPlayerId holds the correct ID, I made sure of it.

PlayFabClientAPI.GetUserData(new GetUserDataRequest
        {
            PlayFabId = PlayFabLogin.PlayFabPlayerId
        }, OnGetUserData, OnPlayFabError);

apisunity3d
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

·
Sarah Zhang avatar image
Sarah Zhang answered

Do you mean this client API GetUserData returned successfully and the Data object in this response is empty? Or this API returned an error? If you got the API result successfully, but the Data object the API returned is empty, it means this player doesn’t own the Player Data K/V pair. You can check the documentation - Quickstart Player Data - PlayFab | Microsoft Docs to set the player data in the Game Manager or set the player data through the API call, then try to get the player data again.

If there is an error message, could you please provide it for our reference?

Besides, for clarification, to call the client API GetUserData to get the caller’s Player Data, you needn’t to pass the PlayFabId in the request body. The client API GetUserData will identify the player based on the SessionTicket in the request header. If you identify the other player’s PlayFabId in the request body, the API will only return the publicK/V pairs of that player. So, if you would like to retrieve the Player Data of the caller, you can also try to call the API GetUserData without providing the PlayFabId.

10 |1200

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

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.