question

Stefano Zinna avatar image
Stefano Zinna asked

SetProfilePolicy in Unity

I am trying to write the SetProfilePolicy function but i get the error: Cannot implicitly convert type 'PlayFab.ProfilesModels.EntityPermissionStatement' to 'System.Collections.Generic.List'

Here is my function. May someone tell me what is wrong? Thank you.

     PlayFabProfilesAPI.SetProfilePolicy(
         new SetEntityProfilePolicyRequest()
         {
             Statements = new EntityPermissionStatement(){
                Action = "Read",
                Effect= EffectType.Allow
             },
             Entity = new EntityKey()
             {
                 Id = entityId,
                 Type = entityType
             }
         },
         (result) =>
         {

         },
         (error) =>
         {
             Debug.LogError(error.ErrorMessage);
         }
         );
unity3d
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

·
Gosen Gao avatar image
Gosen Gao answered

This code points out a type error. According to the document: Account Management - Set Profile Policy - REST API (PlayFab Profiles) | Microsoft Learn, the “Statements” parameter is a List of EntityPermissionStatement. To solve the issue, The code should be modified in the following form:

 Statements = new List<EntityPermissionStatement>()
 {
     new EntityPermissionStatement
     { 
            
     }
 }
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.

Stefano Zinna avatar image Stefano Zinna commented ·

It works. Thanks!

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.