question

joerg-miethe avatar image
joerg-miethe asked

How to access PlayerProfile

1 comment
10 |1200

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

joerg-miethe avatar image joerg-miethe commented ·

Hello I'm using Javascript and PlayFab SDK

when I get:

PmPlayerProfile = new PlayFabClientSDK.GetPlayerProfile({ShowDisplayName : true,});

I can see the data i want in console.log

but when I try:

PmPlayerName = PmPlayerProfile.DisplayName;

or

PmPlayerName = PmPlayerProfile.data.DisplayName;


I got the following error:


Cannot read property 'DisplayName' of undefined


please Help

0 Likes 0 ·

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

Please navigate to [GameManager]->[Title settings]->[Clients Profile Options]. Firstly, make sure [DisplayName] is checked.

Then you can try PmPlayerName = PmPlayerProfile.PlayerProfile.DisplayName.

1 comment
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 ·

BTW, @Joerg Miethe, the way you use profile constraints is not correct. Here is an example:

PmPlayerProfile = new PlayFabClientSDK.GetPlayerProfile(
  {
    "ProfileConstraints":
      {
        "ShowDisplayName" : true
      }
  }
);


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.