Currency Identity
Scripting with the CurrencyIdentity class.
A CurrencyIdentity
provides an identity to a Currency and sets basic rules.
Fields & Properties
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
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.
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.
Get All Currency Identities
Clamp
You can clamp a numeric value or Currency
within a CurrencyIdentity
's min and max ranges.
Last updated