question

leejungyeul avatar image
leejungyeul asked

Can I find a user with PlayFabUserName instead of PlayerId?

Can I find a user with PlayFabUserName instead of PlayerId?

I'm using unity3D.

Originally, the data was sent and received by inputting a player ID, but it was said to be too long.

I've been receiving username from all players and I've been thinking about compare it, but I think it's inefficient.

What should I do?

unity3d
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

·
JayZuo avatar image
JayZuo answered

You can still use GetAccountInfo method to find a user with PlayFab Username instead of PlayFabId. When you want to search with user name, you will need to set Username property in GetAccountInfoRequest instead of PlayFabId. For example:

PlayFabClientAPI.GetAccountInfo(new GetAccountInfoRequest { Username = "theuser" },
    result =>
    {
        //Handle AccountInfo
        Debug.Log(result.AccountInfo.PlayFabId);
    },
    error => { Debug.LogError(error.GenerateErrorReport()); });

And the Username is the one that showed in Master player account as PlayFab username.

However, please note searching on a user is on a match only - it's not a wildcard match, as that could return thousands, or even millions, of records. So if you set Usernameto "the", you will not get the AccountInfo of "theuser", but a "AccountNotFound" error.

Besides, I'm not sure what do you mean "it was said to be too long"? The PlayFabId would be a string with 16 characters, if you are using a valid PlayFabId, it should not be too long.


openedwithimage.png (20.2 KiB)
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.

leejungyeul avatar image leejungyeul commented ·

I solved this problem!Thank you for your reply!

"it was said to be too long"("I heard it's too long") = What my owner wants is a 1-6 character string. So I needed another way.

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.