question

kylemukundi avatar image
kylemukundi asked

How do I store arrays in player data?

Hello. I am making a party invite feature for my game, and I would like to store an array of structs, each struct is a party invite which contains party invite data such as username and avatarurl. However, to store data, you can only use string key-value pairs. How would I go about storing an array?

Player Dataunity3ddata
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 answered

In the common scenario, we will use JSON to store the structured value and convert the format between Objects and String. In PlayFab SDK, you may use the following codes to serialize and deserialize the data:

PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer)

In addition, you may also use the Newtonsoft.Json NuGet package to do the conversion.

10 |1200

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

kylemukundi avatar image
kylemukundi answered

Thank you, could I get a code sample? I'm a little confused but I know what you mean.

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.

Seth Du avatar image Seth Du ♦ commented ·

You may find an example in Sarah's answer of this thread: https://community.playfab.com/questions/40159/how-can-i-access-json-value.html

0 Likes 0 ·
kylemukundi avatar image kylemukundi Seth Du ♦ commented ·

Thank you.

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.