question

ene avatar image
ene asked

Update user Display Name

Good morning, im trying to update my player display name but i got this error

First i tried using UserDisplayName.ToString() but i got the same error

public InputField UserDisplayName;


public void OnUpdatePlayerName()
    {
        PlayFabClientAPI.UpdateUserTitleDisplayName(new UpdateUserTitleDisplayNameRequest
        {
            DisplayName = UserDisplayName.text
        }, result =>
        {
            DisplayNamePanel.SetActive(false);
            GameStartPanel.SetActive(true);
            Debug.Log("The player's display name is now: " + result.DisplayName);
        }, error => Debug.LogError(error.GenerateErrorReport()));
    }
10 |1200

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

Hernando avatar image
Hernando answered

Accord to the error message, the DisplayName field is null in your request. The code you posted seems to be fine but I assume that this is a Unity side issue.

It looks like the value was not passed to the script, please confirm the UserDisplayName has bound to script component you create in UnityEditor.

10 |1200

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

ene avatar image
ene answered

I alrd put it on. I have a game object with "DisplayNamePanel" and inside that game object i have a child "Background", "UserDisplayNameInput", and "Confirm" button. Just in case im using Unity 2018.3.1.f1 version.

public InputField UserDisplayName;

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

Seth Du avatar image Seth Du ♦ commented ·

Can you output the UserDisplayName.text as a debug log before the API is called? I am guessing if this parameter is set correctly.

0 Likes 0 ·
ene avatar image ene Seth Du ♦ commented ·

How i do that ? I terid eveerything i know but i get the red line warning

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ ene commented ·

just print("UserDisplayName: " + UserDisplayName.text); and observe in the console.

0 Likes 0 ·
Show more comments

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.