question

Yoo SeungJi avatar image
Yoo SeungJi asked

How to check if display name is taken?

In my game, after user first login, pop up set user display name window and set display name.

I found through UpdateUserTitleDisplayName check if display name is taken. But it include set display name. I want check if display name is taken exclude set display name. How to I do?

Player Datadata
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

You may call GetAccountInfo and define property TitleDisplayName in the request to check if this displayname has been used. Please note that you don’t want to enable “Allow non-unique player display names” option in title settings, once enabled, this method won’t work and there is no way back.

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.

chronocantway avatar image chronocantway commented ·

Thanks for the answer. For those who want to know what it looks like in my game here is the code private void CheckIfNameIsTaken(string nickname) { var request = new GetAccountInfoRequest { Username = nickname }; PlayFabClientAPI.GetAccountInfo(request, result => { // The given nickname is not taken, so update the user's display name var updateRequest = new UpdateUserTitleDisplayNameRequest { DisplayName = nickname }; PlayFabClientAPI.UpdateUserTitleDisplayName(updateRequest, OnDisplayNameUpdate, OnLoginError); }, error => { // The given nickname is already taken, so display an error message ShowNickNameError(2); //Paremeter = the errortype. }); }

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.