(Sorry, pressed return and it instantly sent my question.) I’m trying to create a system that logs you in, but says “Welcome” + userDisplayName, except I am not sure how to reference the user’s title display name. I’ve read https://community.playfab.com/questions/358/206712347-show-display-name.html however, it’s given me a response of null each time I use those scripts. Please help
GetAccountInfo should be able to get the player's display name. But you need to make sure this player has set the display name. And the display name is not returned in "GetAccountInfoResult.AccountInfo.Username" anymore. Instead, we should use "GetAccountInfoResult.AccountInfo.TitleInfo.DisplayName". Thus, the code should be something like:
public void OnGetUsernameResult(GetAccountInfoResult result) { theLoginScreen.loginStatus.text = "Welcome " + result.AccountInfo.TitleInfo.DisplayName; }
Besides, as you want to get display name upon logging in, you can just add an "InfoRequestParameters" in you login request. Using LoginWithCustomID for example, the request would like:
{ "CustomId": "{ {CustomId}}", "CreateAccount": false, "TitleId": "{ {TitleId}}", "InfoRequestParameters": { "GetUserAccountInfo": true } }
And we can get the display name with "LoginResult.InfoResultPayload.AccountInfo.TitleInfo.DisplayName". For more details about the construct, please check API's response.
2 People are following this question.