question

Alex Vision avatar image
Alex Vision asked

How I can check that name is already taken

Hello. Very good service, thank you.

I have a simple question, how I can check if name already taken for create account, but login with this name is possible. (Unity)

This is may code for login, it's standart:

public void Login() {  
 
	var request = new LoginWithCustomIDRequest {  

		CustomId = SystemInfo.deviceUniqueIdentifier,

		CreateAccount = true,  

		InfoRequestParameters = new GetPlayerCombinedInfoRequestParams {  

		GetPlayerProfile = true  }  

	};  

	PlayFabClientAPI.LoginWithCustomID (request, OnSucess, OnErrorMain);  

}

I think that I need to compare device ID with CustomID in account, because if I make without this, no one will be able to login with himself nickname. So, I need to find CustomID by entered nickname from all players and compare with device ID? How I can make this or maybe there is another way?

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.

Gosen Gao avatar image
Gosen Gao answered

Sorry for the misunderstanding, if your concern is the repeated Display Names or repeated User Names then you don’t have to worry about it. PlayFab will check if the Name is used when you call API UpdateUserTitleDisplayName, RegisterPlayFabUser or API AddUsernamePassword. If the Name is used, you will get an error message like "Username not available" or “Name not available”.

10 |1200

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

Gosen Gao avatar image
Gosen Gao answered

According to Login basics and best practices, it says that ‘Unless you know exactly why you want LoginWithCustomId in your released title, you should migrate to another login mechanism before you launch.’

You could use Anonymous login mechanisms to get your players into game. But once a player logs into your game, you should prompt them to add a recoverable login method, which makes their account recoverable in the case of device failure or other issues.

3 comments
10 |1200

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

Alex Vision avatar image Alex Vision commented ·

Hello, thank you for answer, maybe this is my bad english. No, I am not need recoverable metods and other, I just want that player will not can enter the name which is already taken in leaderboard. Not needed that in leaderboard was two players with the same names

0 Likes 0 ·
Alex Vision avatar image Alex Vision commented ·

Main problem in login, when player login in game leaderboard with himself name, he received a message "this player name is already taken" like when create account and I don't know how resolve this.

0 Likes 0 ·
Alex Vision avatar image Alex Vision commented ·

Maybe in future I will use the other mechanism, but now I just need only leaderboard and some information about gamers, player lvl and money

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.