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
  • Active Instance
  • Open
  • Close
  • Customizations
  • Step 1: Create a New Class
  • Step 2: Override Methods
  • Step 3: Implement Your Customizations
  1. Scripting API
  2. UI
  3. UI Toolkit

Hover Details

Scripting with the InventoolHoverDetails class.

The InventoolHoverDetails class is a mini pop-up window that displays item details.

Fields & Properties

Name
Description
Type
Access

document

The UI document.

UIDocument

protected

root

The root of the content.

VisualElement

protected

topBackgroundElement

The element used to display the top background.

VisualElement

protected

imageElement

The element used to display the item image.

VisualElement

protected

itemNameLabel

The label that displays the item name.

Label

protected

itemTypeLabel

The label that displays the item type.

Label

protected

descriptionScrollView

The scroll view that contains the description.

ScrollView

protected

descriptionLabel

The label that displays the description.

Label

protected

statsScrollView

The scroll view that displays all stats.

ScrollView

protected

weightArea

The element that contains weight content.

VisualElement

protected

weightLabel

The label that displays the item's weight.

Label

protected

currencyIconElement

The element that displays the currency icon.

VisualElement

protected

currencyLabel

The label that displays the currency amount.

Label

protected

appearanceDelay

The length of time the user must hover an item for the details to display.

float

public

autoScrollDelay

The automatic scrolling delay when the scroll view reaches the beginning or end.

float

protected

descriptionAutoScrollSpeed

The automatic scrolling speed of the description scroll view.

float

protected

statsAutoScrollSpeed

The automatic scrolling speed of the stats scroll view.

float

protected

autoScrollDescriptionToEnd

If the description auto scroll is currently scrolling to the end.

bool

protected

autoScrollStatsToEnd

If the stats auto scroll is currently scrolling to the end.

bool

protected

openAction

The open action.

Action

protected

transitionState

The current transition state.

TransitionState

protected

TargetElement

The element currently being targetted.

VisualElement

public

IsOpen

If the hover details is currently open.

bool

public

Active Instance

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

Open

Opening the hover details essentially requires a VisualElement target. By default, Inventool has special UI elements that hold a reference to an item, which is used by the InventoolHoverDetails class to both open at the location of the UI element and also display the item details. So, it's not as easy as just calling an Open method.

// This may only open the hover details without setting the item
InventoolHoverDetails.Instance.Open(myVisualElement);

Close

InventoolHoverDetails.Instance.Close();

Customizations

If you're okay with when the InventoolHoverDetails is opened, but not okay with the information displayed, you can customize it.

Step 1: Create a New Class

Create a new class that inherits from InventoolHoverDetails. In your scene, replace the Hover Details component with the new one you created.

using Esper.Inventool.UI;

public class MyHoverDetails : InventoolHoverDetails
{
    
}

Step 2: Override Methods

using Esper.Inventool.UI;

public class MyHoverDetails : InventoolHoverDetails
{
    // For inventory slots
    public override void Open(ItemStackElement target)
    {
        base.Open(target);
    }
    
    // For equipment slots
    public override void Open(EquipmentSlotElement target)
    {
        base.Open(target);
    }

    // For other purposes (enchanting, crafting)
    public override void Open(ItemSlotElement target)
    {
        base.Open(target);
    }
    
    // For shop items
    public override void Open(ShopItemElement target)
    {
        base.Open(target);
    }
}

Step 3: Implement Your Customizations

In the code example below, we're going to customize the description displayed when an inventory item is hovered with a custom scriptable object.

using Esper.Inventool.UI;

public class MyHoverDetails : InventoolHoverDetails
{
    public override void Open(ItemStackElement target)
    {
        base.Open(target);

        var myCustomClass = (MyCustomClass)target.itemStack.item.customObject;
        descriptionLabel.text = myCustomClass.myCustomDescription;
    }

    public override void Open(EquipmentSlotElement target)
    {
        base.Open(target);
    }

    public override void Open(ItemSlotElement target)
    {
        base.Open(target);
    }

    public override void Open(ShopItemElement target)
    {
        base.Open(target);
    }
}
PreviousAction MenuNextConfirm Prompt

Last updated 3 months ago

Override the four Open methods as shown below. Each one opens the hover details for a different (each UI element has a reference to an item).

📄
UI item element