Inventool Window UGUI

🪟 InventoolWindowUGUI Class

Inventool’s in‑game uGUI window that includes inventory, storage, equipment, key items, shop, crafting, and enchanting systems.

Namespace: Esper.Inventool.UI.UGUI Access: public Type: class Inherits: CrossInputSupportedWindowUGUI


📦 Fields

Access
Field
Type
Description

public

openedTab

Tab

The type of the currently opened tab.

protected

tabButtonContainer

RectTransform

Transform that contains all tab buttons.

protected

selectedTabButton

Button

The currently selected tab button.

protected

inventoryTabButton

Button

Inventory tab button.

protected

craftingTabButton

Button

Crafting tab button.

protected

enchantingTabButton

Button

Enchanting tab button.

protected

keyItemsTabButton

Button

Key items tab button.

protected

inventoryTab

RectTransform

Inventory content container.

protected

craftingTab

RectTransform

Crafting content container.

protected

enchantingTab

RectTransform

Enchanting content container.

protected

keyItemsTab

RectTransform

Key items content container.

protected

shopTab

RectTransform

Shop content container.

protected

storageTab

RectTransform

Storage content container.

protected

activeTab

RectTransform

The currently active tab.

protected

closeButton

Button

Close button.

protected

currenciesContainer

RectTransform

Container that holds currency UI elements.

protected

titleUnderline

RectTransform

Title underline element.

protected

itemStackElementPrefab

ItemStackElementUGUI

Inventory item stack element prefab.

protected

inventorySlotPrefab

InventorySlotUGUI

Empty inventory slot prefab.

protected

inventoryFilterPrefab

InventoryFilterUGUI

Inventory filter prefab.

protected

currencyElementPrefab

CurrencyElementUGUI

Currency display element prefab.

protected

inventoryContent

RectTransform

Inventory content.

protected

pageLeftButton

Button

Inventory previous page button.

protected

pageRightButton

Button

Inventory next page button.

protected

inventoryTitleLabel

TextMeshProUGUI

Inventory title element.

protected

weightLabel

TextMeshProUGUI

Inventory weight amount label.

protected

pagesLabel

TextMeshProUGUI

Inventory pages label.

protected

filterTitleLabel

TextMeshProUGUI

Inventory filter title label.

protected

weightArea

GameObject

Inventory weight area.

protected

inventoryArea

RectTransform

Inventory area.

protected

gridLayoutGroup

GridLayoutGroup

Grid layout for inventory slots.

protected

inventoryContentFitter

ContentSizeFitter

Inventory content size fitter.

protected

filterScroll

ScrollRect

Inventory filter scroll.

protected

inventoryScroll

ScrollRect

Inventory scroll rect.

protected

inventoryCanvasGroup

CanvasGroup

Canvas group used during inventory reload.

protected

pagesArea

RectTransform

Area for pagination text and buttons.

protected

inventoryScrollbar

Scrollbar

Inventory scrollbar.

protected

currencyElements

List<CurrencyElementUGUI>

Loaded currency elements.

protected

inventoryFilters

List<InventoryFilterUGUI>

Inventory filters.

protected

selectedInventoryFilter

InventoryFilterUGUI

Currently selected inventory filter.

protected

loadedInventorySlots

List<InventorySlotUGUI>

Loaded inventory slots.

protected

loadedItemElements

Dictionary<ItemStack, ItemStackElementUGUI>

Loaded item UI elements.

protected

inventoryRequiresReload

bool

True if inventory requires reload.

protected

originalInventoryAreaHeight

float

Original height of inventory area.

protected

storageCurrencyElementPrefab

StorageCurrencyElementUGUI

Storage currency display element prefab.

public

activeStorage

Storage

The storage reference.

protected

storageCurrenciesContainer

RectTransform

Container for storage currency elements.

protected

storageTitleLabel

TextMeshProUGUI

Storage title label.

protected

originalStorageTitle

string

Original storage title text.

protected

storageArea

RectTransform

Storage area.

protected

storageFilterTitleLabel

TextMeshProUGUI

Storage filter title label.

protected

storageFilterScroll

ScrollRect

Storage filter scroll.

protected

storageScroll

ScrollRect

Storage scroll rect.

protected

storageGridLayoutGroup

GridLayoutGroup

Grid layout for storage slots.

protected

storageContentFitter

ContentSizeFitter

Storage content size fitter.

protected

storagePagesArea

RectTransform

Area for storage pagination.

protected

storagePagesLabel

TextMeshProUGUI

Storage pages label.

protected

storagePageLeftButton

Button

Previous storage page button.

protected

storagePageRightButton

Button

Next storage page button.

protected

storageCanvasGroup

CanvasGroup

Canvas group used during storage reload.

protected

storageScrollbar

Scrollbar

Storage scrollbar.

protected

storageCurrencyElements

List<StorageCurrencyElementUGUI>

Loaded storage currency elements.

protected

filters

List<InventoryFilterUGUI>

Storage filters.

protected

selectedStorageFilter

InventoryFilterUGUI

Currently selected storage filter.

protected

loadedStorageSlots

List<InventorySlotUGUI>

Loaded storage slots.

protected

storageLoadedItemElements

Dictionary<ItemStack, ItemStackElementUGUI>

Loaded storage item UI elements.

protected

storageRequiresReload

bool

True if storage requires reload.

protected

originalStorageAreaHeight

float

Original height of storage area.

protected

slotContainer

GameObject

Container with all equipment slots.

protected

rotationResetButton

Button

Button to reset character viewer rotation.

protected

rows

GameObject[]

Equipment slot rows.

protected

equipmentSlotElements

List<EquipmentSlotElementUGUI>

All equipment slot elements.

protected

characterViewerElement

CharacterViewerElementUGUI

Character viewer element.

public

characterViewer

CharacterViewer

Active character viewer.

protected

keyItemPrefab

KeyItemElementUGUI

Key item element prefab.

protected

keyItemScroll

ScrollRect

Scroll rect containing all key items.

protected

descriptionScroll

ScrollRect

Key item description scroll rect.

protected

selectedKeyItemContent

GameObject

Container with selected key item content.

protected

keyItemImage

Image

Selected key item icon image.

protected

keyItemNameLabel

TextMeshProUGUI

Selected key item name label.

protected

keyItemSubtypeLabel

TextMeshProUGUI

Selected key item subtype label.

protected

keyItemDescriptionLabel

TextMeshProUGUI

Selected key item description label.

protected

keyItemsEmptyLabel

TextMeshProUGUI

Label shown when key items list is empty.

protected

loadedKeyItems

List<KeyItemElementUGUI>

Loaded key item elements.

protected

selectedKeyItem

KeyItemElementUGUI

Currently selected key item.

protected

originalDescriptionScrollHeight

float

Original height of description scroll.

protected

shopItemElementPrefab

ShopItemElementUGUI

Shop item element prefab.

protected

shopTitleLabel

TextMeshProUGUI

Shop title label.

protected

shopFilterScroll

ScrollRect

Shop filter scroll rect.

protected

shopScroll

ScrollRect

Shop scroll rect.

protected

activeShopkeeper

Shopkeeper

Active shopkeeper.

protected

loadedShopItems

List<ShopItemElementUGUI>

Loaded shop items.

protected

shopFilters

List<InventoryFilterUGUI>

Shop filters.

protected

selectedShopFilter

InventoryFilterUGUI

Currently selected shop filter.

protected

itemSlotPrefab

ItemSlotElementUGUI

Crafting item slot prefab.

protected

plusSignPrefab

GameObject

Plus sign prefab.

protected

craftingTitleLabel

TextMeshProUGUI

Crafting title label.

protected

craftingSlotElements

List<ItemSlotElementUGUI>

All crafting slots.

protected

plusSignElements

List<GameObject>

All loaded plus sign elements.

protected

craftScroll

ScrollRect

Scroll rect listing items to craft.

protected

contentLayout

HorizontalLayoutGroup

Content layout group for crafting list.

protected

craftCurrencyElement

CurrencyElementUGUI

Result cost currency element.

protected

craftButton

Button

Button that confirms the craft.

protected

craftResultSlot

ItemSlotElementUGUI

Craft result item slot.

protected

craftEmptyLabel

TextMeshProUGUI

Label shown when the craft list is empty.

protected

crafter

Crafter

Crafting logic handler.

protected

activeCraftsman

Craftsman

Craftsman currently being interacted with.

protected

useCraftingCost

bool

True if crafting cost should be used.

protected

enchantingTitleLabel

TextMeshProUGUI

Enchanting title label.

protected

enchantmentSlotElements

List<ItemSlotElementUGUI>

All enchantment slots.

protected

enchantmentSlotLeft

ItemSlotElementUGUI

Left enchantment slot.

protected

enchantmentSlotRight

ItemSlotElementUGUI

Right enchantment slot.

protected

enchantCurrencyElement

CurrencyElementUGUI

Enchanting cost element.

protected

enchantButton

Button

Button that confirms the enchant.

protected

activeEnchanter

Enchanter

Enchanter currently being interacted with.

protected

useEnchantingCost

bool

True if enchanting cost should be used.

public

firstOpen

bool

True if this is the first time the window is opening.


🔍 Properties

Access
Property
Type
Description

public

OpenedForMerchant

bool

True if window is open for merchant or storage.

public

Loaded

bool

True if all UI elements have been loaded.

public static

Instance

InventoolWindowUGUI

The active instance.


🧰 Methods

Access
Method
Returns
Description

protected override

Awake()

void

Initializes singleton, registers UI/events, sets up tabs and localization.

protected override

Start()

void

Reloads inventory, storage, key items; sets viewers; primes crafting/enchanting.

public

LocalizeElements()

void

Localizes UI elements owned by this window.

public virtual

Toggle()

void

Toggles the window open/close state.

public virtual

ForceClose()

void

Forces closing the window or exits merchant/storage context.

public virtual

Open()

void

Opens main window to Inventory; applies tabs visibility based on settings.

public virtual

Close()

void

Closes window (non‑merchant mode); clears tab‑specific state; closes popups.

public virtual

Exit()

void

Closes window in merchant/storage mode; clears tab‑specific state; closes popups.

public

CloseActiveTab()

void

Deactivates the current tab and resets selection.

protected

DisplayTitle(TextMeshProUGUI title)

void

Shows a specific section title and hides tab bar.

protected

DisplayTabs()

void

Shows the tab bar and hides section titles.

protected

MoveInventory(RectTransform parent)

void

Re‑parents inventory content to the target tab container.

protected

ActivateTab(RectTransform tab)

void

Activates a tab and updates selection.

protected

SelectTabButton(Button button)

void

Marks a tab button as selected and disables it.

protected

HandleInitialOpen()

void

Performs initial reload on first open.

private

LateReload()

IEnumerator

Deferred inventory initialization and reload.

private

ReloadInventoryCoroutine()

IEnumerator

Rebuilds inventory layout and reloads current page.

protected

ShowOrHideWeightArea()

void

Toggles the inventory weight area based on settings.

protected

ReloadCurrencyElements()

void

Rebuilds inventory currency UI elements.

public

UpdateCurrenciesText()

void

Updates all inventory currency texts.

public

UpdateWeightText()

void

Updates inventory weight text.

public

UpdatePagesText()

void

Updates inventory pages text.

public

NextPage()

void

Advances to next inventory page.

public

PreviousPage()

void

Goes to previous inventory page.

public

ReloadCurrentInventoryPage()

void

Clears/recreates item elements for current page and updates UI.

public

GetItemElement(ItemStack itemStack)

ItemStackElementUGUI

Gets the UI element for an inventory item stack or null.

protected

ResetLoadedSlots()

void

Resets all inventory slots to available.

protected

SetSlotInUse(InventorySlotUGUI slot)

void

Marks a slot as in‑use visually.

protected

SetSlotAvailable(InventorySlotUGUI slot)

void

Marks a slot as available visually.

protected

CreateItemStackElement(ItemStack itemStack)

ItemStackElementUGUI

Instantiates an inventory item element sized to the stack.

protected virtual

ReloadInventorySlots()

void

Rebuilds inventory slot grid based on navigation mode and width.

protected virtual

ReloadInventoryFilters()

void

Rebuilds inventory filter list and wires actions.

protected virtual

SelectInventoryFilter(InventoryFilterUGUI filter)

void

Selects a filter and updates the title text.

protected virtual

DeselectInventoryFilter()

void

Deselects the active filter.

public virtual

IsPointInsideInventory(Vector2 point)

bool

True if point is inside inventory content element.

public virtual

Open(Storage storage)

void

Opens window for storage; initializes, reloads, and displays storage tab.

public

UpdateStorageTitle()

void

Updates storage title from custom or localized values.

private

StorageLateReload()

IEnumerator

Deferred storage initialization and reload.

private

ReloadStorageCoroutine()

IEnumerator

Rebuilds storage layout and reloads current page.

public virtual

IsPointInsideStorage(Vector2 point)

bool

True if point is inside storage content element.

public

ReloadStorageCurrencyElements()

void

Rebuilds storage currency UI and wires withdraw/deposit prompts.

public

UpdateStorageCurrenciesText()

void

Updates storage currency amount texts.

public

UpdateStoragePagesText()

void

Updates storage pages text.

public

NextStoragePage()

void

Advances to next storage page.

public

PreviousStoragePage()

void

Goes to previous storage page.

public

ReloadCurrentStoragePage()

void

Clears/recreates storage item elements for current page.

public

GetStorageItemElement(ItemStack itemStack)

ItemStackElementUGUI

Gets the UI element for a storage item stack or null.

public

ResetLoadedStorageSlots()

void

Resets all storage slots to available.

public

CreateStorageItemStackElement(ItemStack itemStack)

ItemStackElementUGUI

Instantiates a storage item element sized to the stack.

public virtual

ReloadStorageSlots()

void

Rebuilds storage slot grid based on navigation mode and width.

public virtual

ReloadStorageFilters()

void

Rebuilds storage filter list and wires actions.

public virtual

SelectFirstStorageFilter()

void

Selects the first storage filter.

public virtual

SelectStorageFilter(InventoryFilterUGUI filter)

void

Selects a storage filter and updates title.

public virtual

DeselectFilter()

void

Deselects the active storage filter.

protected virtual

HandleItemEquipped(ItemStack itemStack, EquipmentSlot equipmentSlot)

void

Refreshes equipment slots and marks item equipped in inventory UI.

protected virtual

HandleItemUnequipped(ItemStack itemStack, EquipmentSlot equipmentSlot)

void

Refreshes equipment slots and clears equipped indicator.

public

SetCharacterViewer(Sprite sprite)

void

Sets character viewer to sprite or reverts to 3D viewer.

public

SetCharacterViewer()

void

Binds 3D character viewer render and rotation handlers.

public virtual

ResetCharacterViewRotation()

void

Resets character viewer rotation and stops drag.

public

RefreshAllEquipmentSlots()

void

Refreshes visuals/data for all equipment slots.

private

RefreshAllEquipmentSlotsCoroutine()

IEnumerator

Enables rows based on parity, then refreshes equipment slots.

public

GetEquipmentSlotElementAtPoint(Vector2 point)

EquipmentSlotElementUGUI

Gets equipment slot element at a point or null.

public

ReloadKeyItems()

void

Rebuilds key items list and wires selection.

protected

SelectKeyItem(KeyItemElementUGUI keyItemElement)

void

Selects a key item and populates details UI.

protected

DeselectKeyItem()

void

Deselects the selected key item and hides details UI.

protected virtual

HandleItemSold(ItemStack itemStack)

void

Refreshes inventory UI after a sale (external window if present).

public virtual

Open(Shopkeeper shopkeeper)

void

Opens window for shopkeeper; reloads filters/items and displays shop tab.

protected virtual

ReloadShopItems()

void

Rebuilds shop items list for active filter.

protected virtual

ReloadShopFilters()

void

Rebuilds shop filter list and wires actions.

public virtual

IsPointInsideShopList(Vector2 point)

bool

True if point is inside shop list element.

protected virtual

SelectShopFilter(InventoryFilterUGUI filter)

void

Selects a shop filter.

protected virtual

DeselectShopFilter()

void

Deselects the active shop filter.

protected virtual

HandleCraftingError(string message)

void

Opens prompt for crafting errors (localized if enabled).

public virtual

Open(Craftsman craftsman)

void

Opens window for craftsman and displays crafting tab.

public virtual

UpdateCraftingElements()

void

Updates crafting result slot and cost visibility.

public virtual

IsPointInsideCraftingList(Vector2 point)

bool

True if point is inside crafting list element.

public virtual

ReloadCraftList()

void

Rebuilds crafting list UI and plus signs.

public virtual

AddToCraftList(ItemStack itemStack)

void

Adds an item stack to the craft list.

public virtual

RemoveFromCraftList(int index)

void

Removes an item stack from the craft list.

public virtual

ConfirmCraft()

void

Attempts craft; clears items and refreshes UI on success.

protected virtual

HandleEnchantmentError(string message)

void

Opens prompt for enchanting errors (localized if enabled).

public virtual

Open(Enchanter enchanter)

void

Opens window for enchanter and displays enchanting tab.

public virtual

UpdateEnchantmentCostElements()

void

Updates currency element and button state based on slots.

public virtual

AddToEnchantSlot(ItemStack itemStack)

void

Attempts to place item stack into a valid enchantment slot.

protected

ReloadEnchantmentSlotElements()

void

Reloads enchantment slot icons/tints from settings.

public

GetEnchantmentSlotElementAtPoint(Vector2 point)

ItemSlotElementUGUI

Gets enchantment slot element at a point or null.

public virtual

ConfirmEnchantment()

void

Attempts enchant; updates UI/inventory on success.

protected virtual

EnchantmentCriteriaIsMet()

bool

True if both enchant slots contain valid items.


🧩 Nested types

public enum Tab

Name
Description

None

No tab is selected.

Inventory

Inventory tab.

Crafting

Crafting tab.

Enchanting

Enchanting tab.

KeyItems

Key items tab.

Shop

Shop tab.

Storage

Storage tab.


Active Instance

You can get the active InventoolWindowUGUI instance with InventoolWindowUGUI.Instance. Ensure there's an instance of it in your scene before using this field.

Opening & Closing

Open

The InventoolWindowUGUI can be opened in multiple ways, each for a different purpose.

Opening For Player

Call the Open method when the player wants to open their inventory.

InventoolWindowUGUI.Instance.Open();

Opening For Merchant

You can open the window for the specific merchant by providing the Merchant reference as a parameter.

InventoolWindowUGUI.Instance.Open(myMerchant);

Opening for Storage

You can open the window for a specific storage by providing the Storage reference as a parameter.

InventoolWindowUGUI.Instance.Open(myStorage);

Close

Close closes the window if opened for the player. Use Exit to close the window when opened for a merchant. Optionally, you can use ForceClose to close the window whether it's opened for a merchant or not.

InventoolWindowUGUI.Instance.Close();

Toggle

Optionally, you can use Toggle to open or close the window.

InventoolWindowUGUI.Instance.Toggle();

Character View

Setting Custom Image

If you don't have a Character Viewer set up in your scene, a default image will be displayed in the equipment section. You can override this image with a custom one. A Sprite or Texture2D will be required.

InventoolWindowUGUI.Instance.SetCharacterViewer(mySprite);

Reset Character View Rotation

If you have the Character Viewer set up, you can call ResetCharacterViewRotation to reset its view.

InventoolWindowUGUI.Instance.ResetCharacterViewRotation();

Tabs

The methods below can only be used in a script that inherits from InventoolWindowUGUI.

Close Active Tab

CloseActiveTab closes the tab currently enabled. This is useful if you added your own tabs.

CloseActiveTab();

Activate Tab

Use ActivateTab and provide a RectTransform that acts as the root of the tab. This will enable the tab.

ActivateTab(myTab);

Select Tab Button

To mark a tab button as selected, use SelectTabButton and provide the Button as a parameter.

SelectTabButton(myButton);

Move Inventory

You can move the inventory to a tab with the MoveInventory method. Provide a RectTransform (root of the tab) as a parameter.

MoveInventory(myTab);

Last updated