Inventool Documentation
  • Inventool Documentation
  • đŸ•šī¸Quick Start
    • Installation
    • Start Creating
  • 💡General
    • Running the Demo
    • Menu Options
    • UI Updates
    • UI Customizations
      • uGUI
      • UI Toolkit
    • Custom Item Drops
  • 🎓Tutorials
    • Demo Walkthrough
  • âœī¸Editors
    • Inventool
      • Inventory
      • Equipment
      • Items
      • Currencies
      • Crafting
      • Dismantling
      • Enchanting
      • Stats
        • Stat IDs
        • Attributes
      • Settings
    • Item Type Manager
    • Localization Editor
    • Stats Editor
    • Merchants
      • Shopkeeper
      • Craftsman
      • Enchanter
    • Storage
    • Loot
      • Loot Box
      • Item Pouch
      • Currency Pouch
    • Components
      • Initializer
      • UI
        • uGUI
          • Inventool Window
          • Split UI
            • Inventory Window UGUI
            • Equipment Window UGUI
            • Key Items Window UGUI
            • Crafting Window UGUI
            • Enchanting Window UGUI
            • Storage Window UGUI
            • Shop Window UGUI
            • Selector UGUI
          • Action Menu UGUI
          • Hover Details UGUI
          • Confirm Prompt UGUI
          • Quantity Prompt UGUI
          • Character Viewer Element UGUI
        • UI Toolkit
          • Inventool Window
          • Split UI
            • Inventory Window
            • Equipment Window
            • Key Items Window
            • Crafting Window
            • Enchanting Window
            • Storage Window
            • Shop Window
          • Action Menu
          • Hover Details
          • Confirm Prompt
          • Quantity Prompt
        • Character Viewer
      • Overworld Merchant
      • Storage Keeper
      • Item Drop
      • Item Spawner
      • Input
        • Cross Input Support
        • Cross Input Support UGUI
          • Target Selectable
  • 📄Scripting API
    • Initialization
    • Inventory
    • Equipment
      • Equipment Slot
    • Items
      • Item
      • Item Type
      • Item Stack
      • Item Drop
      • Item Spawner
      • Loot Box
      • Item Pouch
    • Currencies
      • Currency Identity
      • Currency
        • Value
      • Currency Pouch
    • Crafting
      • Craft
      • Crafter
    • Enchanting
      • Enchantment
    • Stats
      • Stat Identity
      • Attribute
      • Stat
        • Stat Value
          • Value
        • Effectiveness
      • Stat Profile
    • Storing
      • Storage
      • Storage Keeper
    • Settings
    • Merchants
      • Shopkeeper
      • Craftsman
      • Enchanter
      • Overworld Merchant
    • UI
      • uGUI
        • Inventool Window UGUI
        • Split UI
          • Draggable Window UGUI
            • Inventory Window UGUI
            • Equipment Window UGUI
            • Key Items Window UGUI
            • Crafting Window UGUI
            • Enchanting Window UGUI
            • Storage Window UGUI
            • Shop Window UGUI
          • Selector UGUI
        • Action Menu UGUI
        • Hover Details UGUI
        • Confirm Prompt UGUI
        • Quantity Prompt UGUI
        • Draggable Element UGUI
          • Equipment Slot Element UGUI
          • Item Slot Element UGUI
          • Item Stack Element UGUI
        • Action Menu Option UGUI
        • Currency Element UGUI
        • Inventory Filter UGUI
        • Inventory Slot UGUI
        • Key Item Element UGUI
        • Shop Item Element UGUI
        • Storage Currency Element UGUI
        • Stat Element UGUI
      • UI Toolkit
        • Inventool Window
        • Split UI
          • Draggable Window
            • Inventory Window
            • Equipment Window
            • Key Items Window
            • Crafting Window
            • Enchanting Window
            • Storage Window
            • Shop Window
        • Action Menu
        • Hover Details
        • Confirm Prompt
        • Quantity Prompt
        • Item Elements
          • Item Stack Element
          • Equipment Slot Element
          • Item Slot Element
          • Shop Item Element
      • Action Menu Option
      • Character Viewer
    • Events
    • Sounds
    • Saving & Loading
      • Inventory & Equipment
      • Storage
    • Input
      • Cross Input Support
      • Cross Input Support UGUI
    • Localization
      • Localization Settings
      • Localizer
  • đŸ› ī¸Support
    • Getting Help
  • 📚Changelogs
    • Latest Releases
    • Future Plans
  • ⭐Rate Me?
Powered by GitBook
On this page
  • Fields & Properties
  • Creating Currency Identities
  • Getting Currency Identities
  • Get a Single Currency Identity
  • Get All Currency Identities
  • Clamp
  1. Scripting API
  2. Currencies

Currency Identity

Scripting with the CurrencyIdentity class.

A CurrencyIdentity provides an identity to a Currency and sets basic rules.

Fields & Properties

Name
Description
Type
Access

id

The currency's unique ID.

int

public

icon

The display icon of this currency.

Sprite

public

displayName

The currency's display name.

string

public

localizedDisplayNameKey

The key of the localized display name string.

string

public

code

The currency's code.

string

public

symbol

The currency's symbol.

string

public

numericType

The currency numeric type.

CurrencyIdentity.NumericType

public

hasMin

If this currency has a min value.

bool

public

hasMax

If this currency has a max value.

bool

public

minIntegerValue

The min value. Used if the value type is set to integer.

int

public

maxIntegerValue

The max value. Used if the value type is set to integer.

int

public

startingIntegerValue

The starting value. Used if the value type is set to integer.

int

public

MinDecimalValue

The min value. Used if the value type is set to decimal.

decimal

public

MaxDecimalValue

The max value. Used if the value type is set to decimal.

decimal

public

StartingDecimalValue

The starting value. Used if the value type is set to decimal.

decimal

public

minFloatValue

The min value. Used if the value type is set to float.

float

public

maxFloatValue

The max value. Used if the value type is set to float.

float

public

startingFloatValue

The starting value. Used if the value type is set to float.

float

public

minDecimalValueAsString

The min decimal value as a string.

string

private

maxDecimalValueAsString

The max decimal value as a string.

string

private

startingDecimalValueAsString

The starting decimal value as a string.

string

private

Creating Currency Identities

It's not at all recommended to create currency identities at runtime, but it is possible. CurrencyIdentity's are scriptable objects which cannot be created as assets at runtime for later use.

CurrencyIdentity identity = ScriptableObject.CreateInstance<CurrencyIdentity>();

The currency identity IDs must be unique. When creating them from the Currencies tab, unique IDs are set automatically. However, this is not done when creating them at runtime. You'd need to create your own method of ensuring IDs of generated currency identities are unique.

Getting Currency Identities

Currency identities created through the Currencies tab can be retrieved at runtime.

Get a Single Currency Identity

You can get a currency identity by its ID, code, or symbol with the Inventool.GetCurrencyIdentity method.

CurrencyIdentity myCurrencyIdentity = Inventool.GetCurrencyIdentity("MyCurrencyCode");

Get All Currency Identities

var currencyIdentities = Inventool.GetAllCurrencyIdentities();

Clamp

You can clamp a numeric value or Currency within a CurrencyIdentity's min and max ranges.

Currency myCurrency = new Currency(myCurrencyIdentity);
myCurrency = myCurrencyIdentity.Clamp(myCurrency);
PreviousCurrenciesNextCurrency

Last updated 3 months ago

📄