question

epicpuppyrawrr avatar image
epicpuppyrawrr asked

UpdateUserData not updating player data,UpdateUserData not updating user data

Trying to update the data of a player when they get a best time (javascript)

var updateRequest = {
    Data: {bestTimes: G.bestTimes},
    Permission: "public"
}
PlayFabClientSDK.UpdateUserData(updateRequest, (response, error) => {
    if (error) {
	console.log(error);
    }
}

The response returns sucessfully but the player data has not updated upon checking the player in the title dashboard

,

Trying to update player data when player gets a best time (javascript)

var updateRequest = {
    Data: {bestTimes: G.bestTimes},
    Permission: "public"
}
PlayFabClientSDK.UpdateUserData(updateRequest, (response, error) => {
if (error) {
    console.log(error);
}
else {
                            
}
});

I get a successful response but the user data does not update upon looking at the title dashboard

Player Data
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.

Sarah Zhang avatar image Sarah Zhang commented ·

If the value of the K/V pair you want to update is null, the request of API UpdateUserData will be successful, but there will be nothing be updated to the player data. Could you please confirm the value of G.bestTimes is not null?

0 Likes 0 ·
epicpuppyrawrr avatar image epicpuppyrawrr Sarah Zhang commented ·

G.bestTimes is a object, I don't know if it matters if the object actually has values but when I tested it G.bestTimes did indeed have a value defined

0 Likes 0 ·

1 Answer

·
epicpuppyrawrr avatar image
epicpuppyrawrr answered

Fixed the issue, just had to use JSON.stringify and JSON.parse to convert the object into a string

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.