Currency provides a small, predictable API for a shared typed balance. Set and modify operations apply Int or Float behavior, save immediately and raise focused events.
Public configuration and state
Member
Type
Purpose
id
int
Unique lookup identifier
currencyName
string
Display, persistence and economy-matching name
type
CurrencyType
Int or Float behavior
defaultValue
float
First-run and reset value
currentValue
float
Current serialized runtime balance
Balance methods
Signature
Returns
Behavior
GetValue()
float
Returns the current typed balance
SetValue(float newValue)
void
Replaces, saves and raises change-direction events
ModifyValue(float amount)
void
Adds a positive or negative delta, then saves and raises events
HasEnough(float amount)
bool
Checks whether the current balance meets the amount
Persistence methods
Signature
Behavior
SaveData()
Writes the current typed value to PlayerPrefs
LoadData()
Loads the typed key or uses Default Value
ResetToDefault()
Restores Default Value, saves and raises reset/change events