question

morganb816 avatar image
morganb816 asked

Failed to get display name user not found

Hey Guys!

Still Relatively new to Playfab user here... I'm trying to make a scene after my login scene that will check if a user has made a display name yet if so it will reveal a play button for instance and if not you will be prompted to input a display name for your account. but i keep getting a error saying Failed to get Display Name User Not found... Probably my code because i'm still getting used to how to write Playfab API out in C#... Here is my code...

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PlayFab;
using PlayFab.ClientModels;
using UnityEngine.UI;


public class CharacterSceneManager : MonoBehaviour {


	public Text DisplayName;
	public GameObject NewCharacterPanel;
	public GameObject CharacterPanel;


	// Use this for initialization
	void Start () {


		GetAccountInfo ();
		/// WRITE IF STATEMENT SAYING IF DISPALY NAME != NULL THEN SHOW INPUT OBJECT TO SET ONE.


	}
	void GetAccountInfo()
	{
		PlayFabClientAPI.GetAccountInfo (new GetAccountInfoRequest () {
			//DISPLAYNAME.TEXT IS A TEXT OBJECT TO DISPLAY PLAYER DISPLAY NAME IF ONE EXISTS... NOT SURE IF THIS IS CORRECT 
			// WAY OF MAKING THAT HAPPEN
			TitleDisplayName = DisplayName.text,
		}, result => {
			print ("Got Display Name");
		}, (error) => {
			print ("Failed To Get Display Name");


			#region Display Error Message In Console
			Debug.Log(error.ErrorMessage);
			if (error.ErrorDetails != null)
			{
				foreach (var ed in error.ErrorDetails)
				{
					Debug.Log(string.Format("ErrorDetail: {0}", ed));
					var kvp = ed.Value;
					foreach (var e in kvp )
					{
						Debug.Log(string.Format("ErrorInfo: {0}",e));
					}
				}
			}
			#endregion


		});
	}
}

Thanks Guys!

-Morgan

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

·
brendan avatar image
brendan answered

Well, "Failed to get Display Name" is from your code above, so the error returned from PlayFab is actually "User Not found". Which means that the TitleDisplayName you're passing into the call does not exist on any player in the Title ID. I'm not sure on the usage though - from the code, it looks like DisplayName isn't actually initialized before it is used. What are you passing in for that, exactly?

2 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.

morganb816 avatar image morganb816 commented ·

So we meet again Brendan! Ok...Maybe i'm using the wrong api then...I diddn't think i was passing in anything honestly haha. I was looking to get a response from Playfab with the TitleDisplayName Of the logged in user... Would this be the correct api for that?

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.