Virtual Currencies #

Defining currencies #

Currencies are defined in the JSON configuration file for your game’s economy system. You can define any number of currencies, and indicate the amounts (if any) of each currency that new players should start with.

This is done via the currencies property of the initialize_user object, for example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "initialize_user": {
    "currencies": {
      "Gold": 0,
      "Silver": 50,
      "Gems": 100
    },
  }
  ...
}

Wallet #

Listing currencies #

You can list the currencies in a user’s wallet.

1
2
3
4
foreach (var currencyKvp in economySystem.Wallet)
{
    Debug.Log($"{currencyKvp.Key}: {currencyKvp.Value}");
}

Refreshing the wallet #

You can refresh the economy system’s wallet data.

1
await economySystem.RefreshWalletAsync();

Currency rewards #

Players can receive currency in many ways, a few examples are by purchasing it via a virtual store, by watching a rewarded video, or as a donation from other players.