question

Saphal Aryal avatar image
Saphal Aryal asked

Updating data like (Level , EXP, Total Match, .......) is best in (UpdateUserData or UpdatePlayerStatistics)

My question is

1.What is best for Updating data like (Level , EXP, Total Match, .......) is best in (UpdateUserData or UpdatePlayerStatistics) ?

2. How can i update the value of only one key from data dictionary in UpdateUserData ?

3. I have a simple Inventory system to purchase item . it works fine.

But how can i instanciate particular character prefab accoding to purchased item?

SomeOneSuggested me to use grantcharactertouser.But I am confused how to use this. what should i pass in character id .

Waiting For your Reply :)

dataPlayer InventoryCharacter Data
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

·
Xiao Zha avatar image
Xiao Zha answered

>>What is best for Updating data like (Level , EXP, Total Match, .......) is best in (UpdateUserData or UpdatePlayerStatistics) ?

The use of these two API should be based on your needs. If you want to have a leaderboard based on the data, you should use the UpdatePlayerStatistics API; if it’s just general player data, you can use the UpdateUserData API.

>>How can i update the value of only one key from data dictionary in UpdateUserData ?

If you saved the data as one key one value, you can just call UpdateUserData API and set the key-value as you want to change. If you saved the data as one key with multiple values(in json format), you should use GetUserData API to get the value first, then modify the value as you want, then update the modified value use UpdateUserData API.

>>But how can i instanciate particular character prefab accoding to purchased item?

You can refer to this answer.

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.

Saphal Aryal avatar image Saphal Aryal commented ·

@Xiao Zha Thanks For Your Reply :)

I am conused about this question.

2. How can i update the value of only one key from data dictionary in UpdateUserData ?

I have various keys in Update User Data like ( level ,experiece, score selected character etc)

and Some time I want to change the oly value of (level or experirnce or score ) key . how can I do this .

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha Saphal Aryal commented ·

As I mentioned above, you can just call UpdateUserData API and set the key-value as you want to change. And can you please tell me how your data is stored if this method does not meet your needs?

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.