Creating New Currencies

The CurrencyData ScriptableObject defines all the in-game currencies (coins, gems, energy, etc.) used in the SlingshotSquad Template.


Step 1 โ€“ Create a Currency Scriptable

  1. In the Project window, right-click and select:

    Create > SlingshotPuzzle > Currency Data
  2. Rename the new asset to match the currency type (e.g., Gold, Diamonds, Energy).


Step 2 โ€“ Assign in GameInstance

  1. Open the MainMenu scene.

  2. Select the GameInstance object.

  3. In the Currency List, add your new CurrencyData asset.

  4. Save the scene.

Your new currency is now integrated into the economy system.


Editable Variables (CurrencyData)

Each CurrencyData has public fields you can configure in the Unity Inspector:

๐Ÿ”น Coin Information

  • coinName โ†’ Display name of the currency.

  • coinID โ†’ Unique identifier (used internally for saving/logic).

  • icon โ†’ Sprite shown in the UI (wallet, shop, HUD).

  • initialAmount โ†’ Amount the player starts with by default.

๐Ÿ”น Maximum Amount Settings

  • useMaxAmount โ†’ Enable if this currency should have a cap.

  • maxAmount โ†’ The maximum allowed value (only visible if useMaxAmount is enabled).

  • canExceedMaxValue โ†’ Allows the value to go over the cap in specific cases (e.g., rewards, gifts).

๐Ÿ”น Rechargeable Settings

  • isRechargeableCurrency โ†’ If true, the currency refills automatically (e.g., โ€œEnergyโ€).

  • rechargeableTimeScale โ†’ Time unit for recharge (Seconds, Minutes, Hours).

  • rechargeableTime โ†’ How long it takes for one recharge cycle.

  • rechargeAmount โ†’ Amount refilled per cycle.

  • RechargeWhileOffline โ†’ If true, recharge continues even when the game is closed.


โœ… Example Uses

  • Gold Coins โ†’ No max limit, collected from levels.

  • Gems โ†’ Premium currency with optional max limit.

  • Energy โ†’ Rechargeable currency, regenerates every few minutes.

Last updated