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
  • Item Class
  • Creating Items
  • Getting Items
  • Get a Single Item
  • Get All Items
  • Creating an Item Stack
  • Getting Icon/Background
  • SpriteType
  • Interpolated Description
  1. Scripting API
  2. Items

Item

Scripting with the Item class.

PreviousItemsNextItem Type

Last updated 2 months ago

While it may seem like the Item class is the main class you'll be working with, it's actually not. Chances are, you'll be using the ItemStack class far more. Basically, the Item class is like an ID for an ItemStack, and the ItemStack class is what is the inventory stores. Click to learn about item stacks.

Fields & Properties

Name
Description
Type
Access

id

The item's unique ID.

int

public

itemClass

The class of the item.

ItemClass

public

currencyPouch

The currency pouch that defines the currency gained when this item is obtained. This is only relevant when item class is set to Currency.

CurrencyPouch

public

icon

The icon of the item that is displayed in the inventory.

Sprite

public

singleSlotIcon

The icon of the item that is displayed in an item slot that is the size of a single slot.

Sprite

public

hoverImage

An image that represents the item. This will be used for the hover details popup.

Sprite

public

keyItemsImage

An image that represents the item. This will be used in the key item section.

Sprite

public

inventoryBackgroundImage

The background image of the item when in the inventory.

Sprite

public

singleSlotBackgroundImage

The background image of the item when in an item slot the size of a single slot.

Sprite

public

hoverBackgroundImage

The background image of the item in the hover details popup.

Sprite

public

shopBackgroundImage

The background image of the item in the shop.

Sprite

public

profile

The stat profile of this item.

StatProfile

public

displayName

The display name of the item that is be displayed in-game.

string

public

localizedDisplayNameKey

The key of the localized display name string.

string

public

itemType

The type of this item.

ItemType

public

description

The description of the item that is displayed in-game.

string

public

currencyIdentity

The currency identity that is used for the costs.

CurrencyIdentity

public

buyingPrice

The price of the item when purchasing from vendors.

Currency

public

sellingPrice

The price of the item when selling to vendors.

Currency

public

overrideDropPrefab

An item drop prefab that overrides the default item drop that is spawned on drop.

GameObject

public

customObject

A custom object for any purpose.

Object

public

dismantleResult

The items gained when this item is dismantled.

List<ItemStack>

public

enchantment

The enchantment that this item provides when it is used to enchant another item.

Enchantment

public

size

The amount of space (slots) this item takes up in the inventory.

Vector2Int

public

weight

The amount this item weighs.

float

public

hideStats

If stats of this item should not be displayed normally when hovered.

bool

public

SlotCount

The number of slots that this item requires.

int

public

Item Class

Name
Description

Normal

Represents a custom item. The item will be treated as normal.

Currency

An item that represents a currency. The item itself won't appear in the inventory. When obtained, it simply adds its currency amount to the player's inventory.

Creating Items

It's not at all recommended to create items at runtime, but it is possible. Items are scriptable objects which cannot be created as assets at runtime for later use. You would need to load your generated items on your own.

Item myItem = ScriptableObject.CreateInstance<Item>();

Item IDs must be unique. When creating items from the Items tab, unique IDs are set automatically. However, this is not done when creating items at runtime. You'd need to create your own method of ensuring IDs of generated items are unique.

Getting Items

Items created through the Items tab can be retrieved at runtime.

Get a Single Item

You can get an item by its ID or display name with the Inventool.GetItem method.

Item myItem = Inventool.GetItem("My Item Name");

Get All Items

var items = Inventool.GetallItems();

Creating an Item Stack

You can create an Item Stack from an Item with the CreateNewItemStack method. This method accepts a integer which represents the stack amount. Note that if an item is not stackable, it will always create a stack of 1.

// Create an item stack of 10
ItemStack myItemStack = myItem.CreateNewItemStack(10);

Getting Icon/Background

You can get a specific item image or background with the GetSprite and GetBackground methods. These methods are generally good to use because they will fallback to an available sprite if the one requested was not set.

var sprite = myItem.GetSprite(spriteType);
var background = myItem.GetBackground(spriteType);

SpriteType

Name
Description

Inventory

The inventory sprite.

SingleSlot

Single slot sprite.

Hover

The on-hover sprite.

KeyItem

The key item sprite.

Shop

The shop sprite.

Interpolated Description

string description = myItem.GetInterpolatedDescription();

You can get the item description with text interpolation with the GetInterplatedDescription method. This essentially helps display stats in item descriptions. Read more about this .

📄
here
here