question

Peter Wiseman avatar image
Peter Wiseman asked

How to Initialize Player Data on Authentication ?

I'm new to PlayFab and have just started moving my GameSparks code over to PlayFab for an already published iOS and Android title that I created with Unity. What's the recommended way of initializing Player Data when a new account is created ? I know I could do it on the client side by checking "result.NewlyCreated" on a succesful player authentication but that feels like it could be hacked. Is there anyway to initialize the Player Data on the server side using some CloudScript ? That's how I did it on GameSparks - I added some CloudScript to the GameSparks "AuthenticationResponse" which was called every time a player authenticated and then initialized any Player Data that hadn't been created yet in the CloudScript. I haven't looked at PlayFab CloudScript yet so I'm not sure if there's a similar way of doing things there ?

Player DataCloudScript
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

·
Gosen Gao avatar image
Gosen Gao answered

When a player account is newly created in the current title, event “player_added_title” will be generated. You can implement a Rule triggered by this event to execute an Azure Function to initiate the Player Data. You can refer to PlayFab CloudScript using Azure Functions Context Models - PlayFab | Microsoft Docs to access event context.

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.