How are you?
I have 2 types of currency for in game content(ex: coins and gems). How can I create and use both currencies? It seems that I have to choose only one of them.
I want the player to buy Items with coins and buy coins with gems. The gems will be sold as IAP for real money.
Is there any way I can achieve that?
I'd really appreciate your help!
Oh! And thank you for the great plugin!
Baroni last edited by
thanks for registering here :)
You can add multiple currencies in the IAP Settings editor, under "In Game Content". There's a button named "Add Currency" (yellow). After you've added your currencies, you can select the active currency via the dropdown field below them, where it says "Selected Currency". This allows you to enter item prices for both currencies, if you want.
Regarding gems -> coins conversion:
- add your consumable gem packages for real money in the "In App Purchases" tab
- in the IAPListener script, define how many gems you want to give to the player, per package, for example:
case "gem_pack1": DBManager.IncreaseFunds("gems", 20); ShopManager.ShowMessage("Bought 20 gems!"); break;
- now, add your consumable gem conversion packs to the "In Game Content" tab. For an item that converts 5 gems to 100 coins, define its price as 5 gems and leave the coin price at 0.
- back to the IAPListener script, add your conversion packs:
case "5gemsToCoins": DBManager.IncreaseFunds("coins", 100"); ShopManager.ShowMessage("Converted 5 gems to 100 coins!"); break;
Done! If this helps, please leave a review/rating on the Asset Store after you've had enough time to get familiar with SIS. Thanks!
Thanks for the quick reply, Baroni! :D
everything that you told me was spot on! I have only one more question..
I've setup everything as you said with both currencies. But when my store gets "mounted" (displayed) it only shows the coins currency!
On my items it shows the regular price, because they are bought with coins, but on the coins_packs the price is 0 (zero). Because they cost 0 coins, but 10 gems. How can I make the coins packs display the gems price while the other items display their coins price?
And I'll definitely give you a rating on the asset store! 5 stars!!!
Baroni last edited by
IAPItem prefabs have a "Price" variable in the inspector, which is an array for text components displaying the prices. The IAPItem prefabs in the demo scenes only have one currency, so the length of this array is 1 (for coins only). If you want to display multiple currencies, you have to resize this "Price" array (to 2 in your case) and assign another text component for the gems (slot 2).
As you only want to show one currency at the time (coins OR gems), it makes sense to have two different IAPItem prefabs - one for your coin items where the gem price is hidden, and one for your gem items where the coins price is hidden. After you've created those prefabs, assign them to your groups in the IAP Settings editor and you should be ready to go.
Oh! Stupid of me.. That was easy! hehe ;)
Thanks a lot, Baroni!!!