question

Ethan K. G avatar image
Ethan K. G asked

Access the other player's entity files

Say you want to download your friends' entity files. Is it doable with Unity PlayFabClientAPI or you must use Cloud Script? Any hint or sample codes?

entities
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

·
Citrus Yan avatar image
Citrus Yan answered

You can use the entity API GetFiles to access a friend's entity files. However, files are not accessible by other players by default, you'd need to modify the profile policy for the players via the SetProfilePolicy API, for instance, a sample policy looks like:

                {
                    "Resource": "pfrn:data--title_player_account!<enter title player id here>/Profile/Files/file1",
                    "Action": "Read",
                    "Effect": "Allow",
                    "Principal": {
                        "Friend": "true"
                    },
                    "Comment": "friend can access file1"
                }
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.

Ethan K. G avatar image Ethan K. G commented ·

@Citrus Yan Thanks for your reply.

Can modify the profile policy manually in Game Manger dashboard or must be done by code using the SetProfilePolicy API?

When use entity API GetFiles, the Id in the request is player's or friend's Id?

var request = new GetFilesRequest
{
    Entity = new PlayFab.DataModels.EntityKey { Id = entityId, Type = entityType }
};
PlayFabDataAPI.GetFiles(request, resultCallback, OnSharedFileFailure);
0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Ethan K. G commented ·

Sure, you can manually modify the policy in GM, via Player Tab -> Policy -> Title Player Account:

And, the id should be of the player itself so that its friend can access the file.

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.