Hi, I am building a multiplayer game in which at certain point I want to update the data of other players even if they are not present in the game at that time. Is there anyway I can do this?
Or If not, then can I create some custom table with custom attributes on Playfab where I can store the sharable data for players to access and update? And when there's a update in that table all players update themselve with new data
Answer by SethDu · Jun 03, 2019 at 02:35 AM
Sorry for previous answer. I seem to have misunderstood your needs.
It is feasible to query and update other players data. First you should know the usage of Player Data: https://docs.microsoft.com/en-us/gaming/playfab/features/data/playerdata/. As the player data, including player read-only data and player internal data, has permission configurations, you can choose any of them as public so that those data can be seen by other users via GetUserData Client API call:
Then, to change other Player's Player Data, you can implement functions in Cloud Script and the action can be easily done by Server APIs. However, be aware that before the change is performed, verification process is necessary so that it will ensure the changes on target player's player data is valid.
If you have seen the description of Title Data in my previous reply, please be aware that Title Data cannot be used to update things on a per-client basis.
How can I call the cloud code of one player from another player? Is there any API function?
Just use Server API GetUserData: https://docs.microsoft.com/en-us/rest/api/playfab/server/player-data-management/getuserdata?view=playfab-rest
If you are providing the REST API for getting data and updating other's player data then why I need the cloud script for?