question

Julian avatar image
Julian asked

How can I set an Object Field to Player (Title) Data in Blueprints?

Hello!

I'm currently trying to set an object field to contain multiple key-value pairs so I am able to have a sort of "structure" for each level in my game.

Here is what I'm trying to achieve in the player data:


This is what I'm currently doing in Blueprints to try make it happen:





However it is not working. There is no error and it succeeds every time, but no data is actually made for the player.

If anyone could help that would be a huge relief, I'd rather not make individual fields for every level.

Also, when a Json object field is made, how do I get/set the value for each one individually?
I am curently only able to get it to print the string of the entire value as it is in the "level1_example" image above.

Thanks in advance!

Player Dataunreal
json-help.png (421.2 KiB)
goal-example.png (19.9 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.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

>> However it is not working. There is no error and it succeeds every time, but no data is actually made for the player.

For clarification, we don’t support setting a JSON object as the value of Player Data’s K/V pair. The value must be a string. You can modify the “level1_example” filed according to the following blueprint to let the data update work.

>> Also, when a Json object field is made, how do I get/set the value for each one individually?

As the first answer said, you would need to use a JSON string as the value. After you made this JSON string, you can decode it to an object then use the “get filed” methods, such as Get bool Field to get the separate filed. The blueprint could be something like this.


json-string.png (58.6 KiB)
getboolfield.png (113.1 KiB)
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.

Julian avatar image Julian commented ·

Thank you very much for the detailed response! It has helped greatly :)

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.