question

illivion avatar image
illivion asked

How to get/set entity objects in CloudScript?

Can I get access to Entity GetObjects/SetObjects methods from CloudScript? I see some undocumented calls here or here. Do 'server' variable really has GetEntity method? Or do we have 'entity' global variable?

apisentitiesdata
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

Yes, there is an “entity” global variable defined in the CloudScript. You can find the corresponding code snippet in the CloudScript default reversion. Besides, when you want to use the caller’s entity to access the Entity API on CloudScript, you need to call the API ExecuteEntityCloudScript. Please check the following threads for more information.

https://community.playfab.com/questions/30595/adding-and-reading-data-fromto-entity-objects-usin.html

https://community.playfab.com/questions/42193/cloudscriptexecuteentitycloudscript-vs-clientexecu.html

In addition to “sever” and “entity”, there is also a “multiplayer” variable that can be used to access PlayFab Multiplayer API. The sample code could be something like this.

    var apiResult = multiplayer.ListMultiplayerServers({
        BuildId: buildId,
        Region: region
    });
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.