question

activedreaminc avatar image
activedreaminc asked

UpdateUserTitleDisplayName Error

Hi, I tried to check if the user already has a Display Name with GetAccountInfo then if the user does not have a Display Name, I ask the user to enter Display Name using UpdateUserTitleDisplayNameRequest. However before the user have a chance to enter the Display Name. It goes straight to error "Invalid Input Parameter". Please help me, thank you

the code is as follows:

// Use this for initialization
 void Start()
 {
 RegisterDisplayNameCanvas.SetActive(false);
 MainMenuCanvas.SetActive(false);
 
 PlayFabClientAPI.GetAccountInfo(new GetAccountInfoRequest()
 {
 
 }, result =>
 {
 if (result.AccountInfo.TitleInfo.DisplayName != null)
 {
 MainMenuCanvas.SetActive(true);
 
 DisplayNameText.text = result.AccountInfo.TitleInfo.DisplayName;
 
 PhotonNetwork.playerName = DisplayNameText.text;
 }
 else if (result.AccountInfo.TitleInfo.DisplayName == null)
 {
 RegisterDisplayNameCanvas.SetActive(true);
 
 RegisterDisplayName();
 }
 
 }, error =>
 {
 Debug.LogError(error.ErrorMessage);
 });


void RegisterDisplayName()
{
    PlayFabClientAPI.UpdateUserTitleDisplayName(new UpdateUserTitleDisplayNameRequest()
    {
        DisplayName = DisplayNameInputField.text
 
    }, success =>
    {
        PhotonNetwork.playerName = success.DisplayName;
 
    }, failure =>
    {
        Debug.Log(failure.ErrorMessage); //this is line 106
 
    });
}

the error message is below:


Invalid input parameters
UnityEngine.Debug:Log(Object)
ConnectToGame:<RegisterDisplayName>m__3(PlayFabError) (at Assets/Scripts/ConnectToGame.cs:106)
PlayFab.Internal.<MakeApiCall>c__AnonStorey1:<>m__0(String) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:110)
PlayFab.Internal.<PostPlayFabApiCall>c__Iterator0:MoveNext() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:173)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)


Account ManagementAuthentication
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

·
activedreaminc avatar image
activedreaminc answered

sorry, silly mistakes, I got it fixed. Is there any way to convert PlayFab error message to a pop up screen showing the user that "Name is not available" or "Account not found" etc? thank you

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.

brendan avatar image brendan commented ·

Sure, you can use the error code returned to determine what to display. In this case, NameNotAvailable would be the error code to use for "Name is not available". There isn't an "Account not found" for that particular API call, though - that would be the response to a login call where CreateAccount is set to false (the default) and the credentials presented are not associated with any existing player account.

0 Likes 0 ·
activedreaminc avatar image activedreaminc commented ·

Thank you Brendan :)

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.