Skip to content

An easy to set up virtual currency manager; load, save and convert virtual currencies.

License

Notifications You must be signed in to change notification settings

FredericRP/PlayerCurrency

Repository files navigation

openupm

Player Currency

An easy to setup in game currency manager.

It uses the PersistentDataSystem to load and save data.

Usage

Call the PlayerCurrencyManager to get or add virtual currency amount to your players.

Each currency has its own unique string identifier, we advise you to include it in a list as it's shown in the GameQuest sample. By default, the tool will use CurrencyList.txt as the data list.

Retrieve the currency amount the player has

int playerGoldAmount = PlayerCurrencyManager.Instance.GetCurrencyCount("gold");

Add a certain amount of currency to the player

PlayerCurrencyManager.Instance.AddToCurrency("gold", 500);

The currency is protected to prevent going below 0.

Advanced - Money conversion

It contains a conversion system to allow you creating multiple conversion between virtual currencies (used in general as In App Purchases).

Money Conversion data

int coinAmount = PlayerCurrencyManager.Instance.GetConvertedCurrency(50, "gems", "coins");

In this case, coinAmount equals 500.

About

An easy to set up virtual currency manager; load, save and convert virtual currencies.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages