I accidentally submitted my question before completing it and do not know how to edit it. Here is what I have tried. In a class I have:
private PlayFabEvents playFabEvents;
playFabEvents.OnSubtractUserVirtualCurrencyResultEvent += UpdateCurrencyAmountText;
playFabEvents.OnAddUserVirtualCurrencyResultEvent += UpdateCurrencyAmountText;
public void UpdateCurrencyAmountText(ModifyUserVirtualCurrencyResult modifyUserVirtualCurrencyResult)
{
//Code to update text showing virtual currency
}
The intention of this is that any time the user's virtual currency changes, UpdateCurrencyAmountText will be called. However playFabEvents does not have a value assigned to it and I cannot find what to assign to it. So, am I going in the right direction here and if so, what will I assign to playFabEvents?
The successful callback of AddUserVirtualCurrency and SubtractUserVirtualCurrency API call contains the change information, however, there are few things you may need to know.
Hence, the common scenario will be subscribing the callback result of ExecuteCloudScript, where verification of gaming process will be done before the VC is changed via Server API.
In addition, clients may also call GetUserInventory API to retrieve the VC actively.
2 People are following this question.