v3.1.2
2020.3+

Class PlayerBalance

Represents a single currency balance for a player.

Inheritance
PlayerBalance
Namespace: Unity.Services.Economy.Model
Syntax
[Preserve]
public class PlayerBalance

Constructors

PlayerBalance(String, Int64, String, EconomyDate, EconomyDate)

Declaration
[Preserve]
public PlayerBalance(string currencyId = null, long balance = 0L, string writeLock = null, EconomyDate created = null, EconomyDate modified = null)
Parameters
TypeNameDescription
StringcurrencyId
Int64balance
StringwriteLock
EconomyDatecreated
EconomyDatemodified

Fields

Balance

The amount of this currency the player has.

Declaration
[Preserve]
public long Balance
Field Value
TypeDescription
Int64

Created

The date this balance was created as an EconomyDate object.

Declaration
[Preserve]
public EconomyDate Created
Field Value
TypeDescription
EconomyDate

CurrencyId

The ID of the currency this balance represents.

Declaration
[Preserve]
public string CurrencyId
Field Value
TypeDescription
String

Modified

The date this balance was modified as an EconomyDate object.

Declaration
[Preserve]
public EconomyDate Modified
Field Value
TypeDescription
EconomyDate

WriteLock

The current WriteLock string.

Declaration
[Preserve]
public string WriteLock
Field Value
TypeDescription
String

Methods

GetCurrencyDefinition()

Gets the currency definition for this balance.

Declaration
public CurrencyDefinition GetCurrencyDefinition()
Returns
TypeDescription
CurrencyDefinition

The CurrencyDefinition that this balance refers to.

GetCurrencyDefinitionAsync()

Gets the currency definition for this balance.

Declaration
[Obsolete("This has been replaced with GetCurrencyDefinition which is not asynchronous and should be accessed from there instead. This API will be removed in an upcoming release.", false)]
public async Task<CurrencyDefinition> GetCurrencyDefinitionAsync()
Returns
TypeDescription
Task<CurrencyDefinition>

The CurrencyDefinition that this balance refers to.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful