IInventoryItem

Inventory Service

Interface

Represents an item in the user's inventory / backpack.

Properties

amount

The amount of the item owned in the inventory

consumableCooldownRemaining

Cooldown time remaining

consumableDurationRemaining

How long the consumable item's effects remains.

isConsumable

True if the item is consumable

isConsumeActive

True if the item is being consumed (consumableDurationRemaining > 0)

isOnCooldown

True if the item is on cooldown (consumableCooldownRemaining > 0)

isOwned

Does the user have this item in their inventory?

itemID

Item ID. This can be found on Spatial Studio

Methods

SetEnabled(bool, string)

Set the enabled state for an item in the user's inventory. This can be useful to prevent users from equipping or consuming certain items based on logic within your experience. All items in the user's inventory are enabled by default.

Use()

Use the item. This will trigger the OnItemUsed event.

Events

onConsumableItemDurationExpired

Triggered when a consumable item's effects finish (consumableDurationRemaining == 0).

onItemAmountChanged

Triggered when an item's amount has changed.

onItemConsumed

Triggered when user uses a consumable item (item's amount decreases by 1) before consume duration timer starts.

onItemUsed

Triggered when the user uses an item.