question

Arunprakaash G avatar image
Arunprakaash G asked

How can I Store a list of strings or integers in Playfab

How can I Store a list of strings or integers in Playfab for eg in unity List<strings> in playfab

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

·
Ivan Cai avatar image
Ivan Cai answered

As your problem describes, you can save the list as a JSON array. In this regard, I write an example as follows:

    List<string> TestList = new List<string>() {"Ford","BMW","Benz"};
    
    public void TestStoreList() 
    {
        PlayFabClientAPI.UpdateUserData(new UpdateUserDataRequest
        {
            Data = new Dictionary<string, string>()
            {
               {"Cars",PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer).SerializeObject(TestList) }
            },
            Permission = UserDataPermission.Private
        },OnSuccessStoreList => {},OnError=> {});
    }
    

After saving successfully, as shown in the figure:


sample3.png (5.3 KiB)
10 |1200

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

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.