question

Albertus Ari Kristanto avatar image
Albertus Ari Kristanto asked

Why should we use CloudScript like for update player's data?

Hello.

I'm new on this playfab platform.

I'm planning on using playfab and photon for my unity game.


I already read the documentation for CRUD player data and cloudscript.

I saw that we can call the function like PlayFabClientAPI.GetUserData in Unity to Get user data.

And on the other hand, we can use CloudScript to get the user data.

But it's harder, cause we need to set the script first in playfab server and execute it from client.

So maybe someone can explain me when and why we use CloudScript?

Thankyou

CloudScript
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

·
Citrus Yan avatar image
Citrus Yan answered

The main purpose of CloudScript is to give you the ability to build server-side logic and functionality that your client code can request execution of. You can create CloudScript functions that can only be accessed via your game, to prevent any tampering attempts from clients. For example, let’s say this game of yours gives “daily reward” to players, however, you can’t trust the client-side because they may ask for it multiple times, which is detrimental to your game. In that case, you can use CloudScript to implement a server-side validation to prevent granting the reward twice.

CloudScript has access to the full set of Server API calls, which enables your cloud code to act as a dedicated server. Usually we don’t just get the user data and return it to the clients from CloudScript, instead, oftentimes we use it in conjuction with other calls/functions to implement a more sophisticated server-side logic. I would suggest you follow through the tutorial on CloudScript to gain more insights about it.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Albertus Ari Kristanto avatar image Albertus Ari Kristanto commented ·

Thankyou for your respond, ill try the tutorial then

1 Like 1 ·

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.