Usage of other services from within Cloud Code.

I was looking where I could optimize some places where I am doing multiple UGS calls at basically the same time and turn them into a single Cloud Code batch call.

This has the obvious benefit of a single call over the web. However it got me thinking about usage of other services from within a cloud code call.

For example if i do....

const cloudSaveApi = new DataApi({ accessToken });
cloudSaveApi.setItem(projectID, userID, 'thekey', 'theval');
cloudSaveApi.setItem(projectID, userID, 'key2', 'val2');

Now this is a bad example because of the existence of the setItemBatch call, and i am assuming it would count as two reads from your Cloud Save Read total.

Is my assumption that the usage is the same if you make the calls from inside the game vs inside a cloud code script? Is it true for all services?


Hi Chris,

Yes, you are exactly right. If you make a call to another service through cloud code then it will add to your usage. exactly the same way as if you were doing it from the client such as to Cloud Save or Economy. The batch method is definitely good practice when using your example to reduce the usage counter for certain checks.

For others curious about the batch method you can find more info here.

Thanks for the info.