Search Unity

Question Dynamically changing the Currency and Transaction values at runtime.

Discussion in 'Game Foundation' started by Raghavendra, Sep 27, 2020.

  1. Raghavendra

    Raghavendra

    Joined:
    Mar 14, 2014
    Posts:
    52
    Hi,

    Is there any way we can change values like the following at runtime.

    1) Initial Allocation of currency.
    2) Costs and rewards of transactions.
    3) Store transaction orders.

    I know there are plans to support cloud services in the future. But is there anyway, I can change these values through Remote config in the 0.6.0 version?

    Thanks for this wonderful package!!
     
  2. Raghavendra

    Raghavendra

    Joined:
    Mar 14, 2014
    Posts:
    52
    @erika_d , @mingz-unity @JeffDUnity3D Any idea about this?

    Sorry for directly tagging you guys, but I am kinda in a hurry as otherwise, I might have to look for alternate solutions.:oops:
     
  3. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    Hi @Raghavendra

    Thank you for your question and your interest in Game Foundation! I'm glad you are enjoying it so far. :) Currently, these values are read-only at runtime and we don't support changing values using services like Remote Config. In our next release, there will likely be an interface that you could use to change some values with a service like Remote Config, I expect that it would help with number 1, though I don't think it would help with 2 or 3. Because it's not released yet though, that prediction and the feature is always subject to change, so I can't fully commit to any details on it. If you could share some of your use cases for wanting to change these particular values at runtime though, that would be helpful.

    Some potential workarounds that are available in the 0.6 release:
    1) You could change the balance of the currency at runtime, after the initial balance has been set, which you could maybe pair with Remote Config (i.e. WalletManager.SetBalance(definition, valueFromRemoteConfig); ) You would have to make sure that that only happens on initial addition of the currency to the wallet though, since initial allocation is only triggered the first time a new currency is added to a player's wallet.

    2) For this one you could make a few different versions of the transaction with different costs and rewards, and then choose which one to show during runtime.

    3) By Store Transaction orders do you mean which transactions are added to the Store Transactions list or do you mean the order the transactions that are in the list show up in? (Or a third interpretation I haven't thought of?) For the former you might be able to play with adding different tags to the transactions, and then filtering the store based on which tag you want to display using GetStoreItemsByTag().

    i.e. if you made 3 different transactions with different cost/payouts as part of 2, then you could give each of them a different tag like newUser, returningUser, advancedUser, add all three of them to your Store, and then filter by tag based on the user, and perhaps based on a remoteConfig setting as well.

    Let me know if you think any of those workarounds would help, or if you can provide your use cases maybe I can help further!
     
  4. Raghavendra

    Raghavendra

    Joined:
    Mar 14, 2014
    Posts:
    52
    @erika_d, Sorry for the late reply. But I used your solution given for points 1 and 2. And it worked. Point 3 wasn't required for this release, so will work on it when it is required. Thanks for the help.
     
    erika_d likes this.