So I want to grant items to a player after they complete a level.
The rewards they earn are some coins + some items (all generated client side). What is the recommended way to get these into the Playfab player's inventory and virtual currency wallet?
1) I understand that one way would be to emit a custom play stream event. Then have some cloudscript parse that event and grant the item / currency.
I have some concerns about this one, as there is no control on when the event gets triggered. The player exit the level (the event is sent) and client side, we show the rewards are granted. They try to equip the new item, but it's possible there is a state mismatch between client/server as the event may not been triggered yet?
2) The second one is to request execute cloud script from client with the items/coins in the payload. Similar to the event but this one can be synchronous / waited on.
Which is the recommended way? Maybe there is a better approach?
We would also like to allow offline play to cache items, but that one shouldn't matter too much. It can be cached and either option 1 or 2 can be used when the player comes back online.
Thanks