question

robert avatar image
robert asked

com.playfab.player_added_title execution order

We want to give default items to new users. We thought about using com.playfab.player_added_title and grant the user the default items. Our questions now is, when will com.playfab.player_added_title be executed?

Our client code logs in new users using one of the login methods and right after the login succeeds fetches the user inventory with GetPlayerCombinedInfo or a custom cloud script method. Is it guaranteed that the com.playfab.player_added_title event was executed already right before we call our first execute cloud script method? Or can com.playfab.player_added_title happen at any time later?

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

·
brendan avatar image
brendan answered

The player_added_title event is generated the first time the player signs into the service on the title ID in question. If there's an action to run a Cloud Script associated with that event, it will run as a result of the event showing up in the PlayStream. But to be clear, we do not wait on all of that to be done before returning from the Login... call, as that could cause problems. Events are fired into PlayStream as a result of actions, but they are asynchronous to those actions.

So no, if you query the inventory immediately after the login call, odds are good the Cloud Script you trigger on that event won't be complete yet. What I would recommend is to sign the player in invisibly on start (using Device ID), and only query for the inventory after you've completed your startup (logos, any intro screens/text, etc.).

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.

robert avatar image robert commented ·

Thanks for the details.

.....and only query for the inventory after you've completed your startup (logos, any intro screens/text, etc.).

We do something similar already but nevertheless can't use player_added_title as it still might not have executed then. Anyway, no problem, we will just call a new CreateDefaultInventoryIfPlayerJustCreated() method which will handle new player signups.

Thanks!

0 Likes 0 ·

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.