question

Super.tt avatar image
Super.tt asked

How do i get player id title!!

Hi,

Currently I am working on a feature that allows my users to choose the language.

The code I use:

PlayFabProfilesAPI.SetProfileLanguage(
            new PlayFab.ProfilesModels.SetProfileLanguageRequest
            {
                Entity = new PlayFab.ProfilesModels.EntityKey
                {
                    Id = "Player ID (title)",
                    Type = "title_player_account"
                },
                ExpectedVersion = 0,
                Language = "en",
            },
            success => { Debug.Log("set successfully"); },
            fail => { Debug.Log(fail.GenerateErrorReport()); });

but i can't find how to get "Player ID (title)".

I'm try:

PlayFabClientAPI.GetPlayerCombinedInfo(new GetPlayerCombinedInfoRequest(), 
            result => { Debug.Log("playfabId "+result.InfoResultPayload.AccountInfo.PlayFabId); }, 
            fail => { Debug.Log(fail.GenerateErrorReport()); });

and:

PlayFabClientAPI.GetAccountInfo(new GetAccountInfoRequest(), 
            result => { Debug.Log("playfabId "+result.AccountInfo.PlayFabId); }, 
            fail => { Debug.Log(fail.GenerateErrorReport()); });

but I just get Player ID

Am I wrong somewhere? Do you have any ideas?

apis
8mxvk.png (56.3 KiB)
tyd1j.png (42.6 KiB)
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

·
Seth Du avatar image
Seth Du answered

I understand that you want to get the title player ID to set their profile language, and you have tried the GetPlayerCombinedInfo API and GetAccountInfo API.

If you want to use GetPlayerCombinedInfo to get title player ID, you need to specify GetUserAccountInfo in the request to be true. If you are using Unity, you can change the first line of code snippet 1 as :

PlayFabClientAPI.GetPlayerCombinedInfo(new GetPlayerCombinedInfoRequest
            {
                InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
                {
                    GetUserAccountInfo = true
}
},

Then you can get the title player ID by result.InfoResultPayload.AccountInfo.TitleInfo.TitlePlayerAccount.Id

If you would like to see the structure of this API’s response, you can refer to Get Player Combined Info.

If you want to use GetAccountInfo to get title player ID, then you can get the title player ID by result.AccountInfo.TitleInfo.TitlePlayerAccount.Id

You can refer to Get Account Info for this API.

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.

Super.tt avatar image Super.tt commented ·

It worked! Thanks for your help!
I struggled with this for a day before coming up here for help.

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.