question

psilvestre avatar image
psilvestre asked

UpdatePlayerStatistics is an asynchronously call?

Hi,

I have implemented a CloudScript call to update various leaderboards in a single client-server call. I have included code to check if player has improved his position updating leaderboards, getting player position in leaderboards before and after updating each leaderboard and comparing values. The problem is that I have obtained the same leaderboard values on CloudScript before updating new values in leaderboard and after obtaining them checking the method GetLeaderboardAroundUser. I have checked that leaderboards have been updated after...

In summary the question is: how could I know that server.UpdatePlayerStatistics is completed in CloudScript? If it is not possible, I should do another client-server call to get leaderboard updated.

Thanks.

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

·
brendan avatar image
brendan answered

The player statistics call is not asynchronous, but the update of the leaderboard for new position info is. So yes, it could take a second or so for the leaderboard to be up-to-date with the new position for the player. So calling get leaderboard immediately after update statistics isn't going to get you the new position for the player. What I would recommend is to do the leaderboard update in the Cloud Script, and then have the client query for the updated leaderboard after the Cloud Script returns.

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.