question

andymadin avatar image
andymadin asked

Creating player data with Public permissions from Unity

Hi, i'm trying to set some profile player data from Unity side, it works fine but the new key that is created has the Private permission but I need it to be public, does anyone know how to do this?

Thanks!

 var request = new UpdateUserDataRequest
             {
                 Data = new Dictionary<string, string>{
                 {"Profile", "some profile info"},
             }
             };
Player Dataunity3d
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

·
Simon Cui avatar image
Simon Cui answered

You can set "Permission" to "Public". Like the codes shown below:

             var request = new UpdateUserDataRequest
             {
                 Data = new Dictionary&lt;string, string&gt;{
                 {"Profile", "some profile info"},
                 },
                 Permission = UserDataPermission.Public
             };

For more information, please refer to the Documentation of Player Data Management - Update User Data.

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.

andymadin avatar image andymadin commented ·

Thanks to Simon who helped me off on the right path, i don't know why but i had to use:

      var request = new UpdateUserDataRequest
      {
          Data = new Dictionary<string, string>{
          {"Profile", "some profile info"},
          },
          Permission = UserDataPermission.Public

      };
1 Like 1 ·
andymadin avatar image andymadin commented ·

Hi Simon, thanks for replying, I get the error on the word "Public": Cannot explicitly convert type 'string' to 'Playfab.ClientModels.UserDataPermission'

At the top of the script I have:

using PlayFab; using PlayFab.ClientModels;

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.