Item View
An Item View presents one ItemInfo through reusable visual modules. Use it for a Bag slot, Equipment slot, hotbar entry, shop row, crafting ingredient, or Item Description when the Item’s icon, name, amount, Attributes, or state must update without rebuilding the UI.
The Item View displays data; it does not own the Inventory or decide what a click does. Its Item View Slot, container, drawer, and category mapping provide those surrounding responsibilities.
Before you begin
Confirm that:
- Health Potion, Iron Sword, and Fire Wand exist in the selected Inventory System Database;
- each definition has a valid
IconSprite when the View will show an icon; - a project-owned UI Designer schema has been duplicated and spawned;
- a Bag Inventory Grid or another Item View Slots Container exists for testing; and
- the target Inventory and player ownership are already correct on that container or menu.
Start with a simple shared prefab. Create category-specific or context-specific prefabs only when the information or layout genuinely differs.
Understand the surrounding components
| Component | Responsibility |
|---|---|
| Item View | Holds the current ItemInfo and sends set-value, clear, select, click, hide, and refresh operations to compatible View Modules. |
| Item View Module | Draws one concern, such as Icon, name, amount, selection, or equipped state. |
| Item View Slot | Wraps the View in an action button, supplies the slot index, applies restrictions, detects selection and submit or pointer clicks, and forwards select or click state to the View. |
| Item View Slots Container | Owns a group of slots, binds an Inventory, redraws on Inventory changes, and publishes selection, click, and drag-and-drop events. |
| Item View Drawer | Creates or reuses Views, clears old state, assigns the new ItemInfo, and obtains the correct prefab from a Category Item View Set. |
| Category Item View Set | Maps Item Categories to Item View prefabs and supplies an Empty Item View when the Item is null. |
Keep input and Inventory logic on the slot, container, or binding. A standalone Item View can render Iron Sword, but it cannot equip that sword or move it from Bag to Equipment by itself.
Create an Item View
- Open Tools > Opsive > Ultimate Inventory System > UI Designer.
- Select Item View and open Create.
- Choose Item View Preset. For Grid is the default; released Version 1 also supplies For List, For Shop, For Item Shape, For Ingredient, and For Inventory Monitor.
- Set Parent Transform when the new View should be created under a specific layout, then create it from the duplicated project schema.
- Open Edit, select the generated View, and add or remove entries in ItemView Modules.
- Assign every module’s Image, Text, Sprite, child object, Attribute name, or other required reference.
- Save the project-owned prefab and assign it to the intended Category Item View Set.

On the Item View component, Target Graphic becomes the target graphic of its Item View Slot. Assign Canvas Group when the whole View must be hidden and made non-interactable with the View API.
Choose modules by scenario
Show a normal Bag Item
Use a small set first:
- Icon Item View reads the exact
IconSprite Attribute. Assign Icon, choose a Missing Icon, and enable Disable On Clear only when an empty slot should hide the Image component. - Name Item View writes the Item’s name to Name Text.
- Amount Item View writes the current
ItemInfo.Amountasx amount. Hide Threshold defaults to1; the optional Disable Below Threshold and Disable Above Threshold objects let the layout change on either side of that threshold. - Enable Disable Item View Module switches separate GameObject groups for occupied and empty states.
Health Potion normally uses Icon and Amount. Iron Sword and Fire Wand may use the same prefab, but a unique weapon amount is usually less useful than its equipped or durability state.
Make selection visible
Use Select Image View to swap an Image between Default and Selected Sprites, or Select View to enable different GameObjects and invoke its selection event. These modules receive selection from the Item View Slot. Without a slot, their cleared state is deselected.
The View itself should not add another Button to compete with the Item View Slot. Keep one interaction owner so pointer, keyboard, and controller selection agree.
Show equipment state
Use Equipped Item View to enable objects while an Item is equipped, or Equipped Select Item View when one Image must represent default, selected, equipped, and equipped-selected states.
Both modules first look for the boolean Attribute named by Equipped Attribute Name, which defaults to IsEquipped. When that Attribute is absent, they compare the Item’s current collection with the equipped collection identifier, whose default purpose is Equipped. This requires an ItemInfo that retains its source Item Collection.
Do not use Item Slots Item View as an equipment marker. It draws icons for Items stored in an ItemAmounts Attribute named Slots, with each contained Item’s Icon; it is intended for sockets or Items that contain other Items.
Show Item Attributes or prices
- Attribute Item View converts a named Attribute value to text, uses Default Text Value when cleared, and can disable a chosen GameObject when the Attribute is missing.
- Int Attribute Item View reads only an integer Attribute and clears its text to
0. Use it for an integerAttackorDurabilityvalue. - Attribute View For Item View Module sends one named Attribute into a nested Attribute View when the value needs its own reusable presentation.
- Category Attribute View Set Item View Module builds several Attribute rows for an Item Description.
- Currency Item View reads a
CurrencyAmountsAttribute named by Currency Attribute Name and draws it through an assigned Multi Currency View. A rawBuyPriceis suitable for a basic display, while a Shop may replace it with a context-specific processed price after drawing.
Compare against an Inventory
Use Inventory Amount Item View when the row should show the total amount of the Item Definition in an Inventory. Use Inventory ID is disabled by default; when enabled, Inventory ID defaults to 1. Use Amount Comparison Item View for an available/required display with positive and negative colors, optionally restricted to named Item Collections.
These modules need the intended Inventory through their runtime context. A missing Inventory produces a warning and clears the display, so verify ownership in split-screen or dynamically spawned UI.
Use specialized presentation
Use the dedicated modules and preset for special systems:
- Item Shape Item View and its companion selection, drop-preview, and placement modules are required for multi-cell Item Shape UI.
- Cooldown Item View is for the compatible Item Action cooldown flow. Its defaults look for Inventory Identifier
1, theCooldownAttribute, and Item User data namedItemCooldown; it is not a general timer. - Drop Hover Icon Preview Item View is driven by an Item View Drop Handler during drag-and-drop.
Map prefabs by category
Create the mapping asset with Create > Ultimate Inventory System > UI > Category Item View Set.
- Assign Empty Item View when empty slots should use a prefab.
- Map All to the common grid View.
- Add Weapon only when Iron Sword and Fire Wand need a more specific presentation.
- Add Consumable only when Health Potion needs a distinct presentation.
- Assign the set to Category Item View Set on the Item View Drawer.
- Keep Use View Slot enabled, its Version 1 default, when the drawer must create or reuse Item View Slots for interaction.
- Confirm that the drawer and container use the intended Content transform.
The set selects the most specific matching category mapping it can resolve through category inheritance. A null-category entry can act as a broad fallback, but an explicit All mapping is clearer for the shared database. With multiple incomparable parent categories, avoid ambiguous competing mappings or verify the resolved prefab deliberately.
Choose a safe customization scope
| Intended change | Edit | Result |
|---|---|---|
| One panel in one scene | The generated scene or prefab instance | Other consumers keep their existing presentation. |
| Every use of one layout | A project-owned Item View prefab | Each drawer that resolves that prefab receives the change. |
| Future UI Designer output | The corresponding prefab in the duplicated schema | Newly generated Views start with the change. |
| A genuinely different context | A separate grid, list, shop, ingredient, monitor, or Item Shape prefab | One context can change without clipping or overloading another. |
| A genuinely different category | A separate prefab mapped in Category Item View Set | Only the matching category branch uses the variation. |
Do not edit the package or demo prefab directly. After changing a shared prefab, recheck every grid, Equipment view, hotbar, shop, and crafting panel that consumes it.
Editor checkpoint
Before entering Play Mode, confirm that:
- the prefab belongs to the project or duplicated schema;
- it has one Item View component and the intended Item View Modules;
- Target Graphic, optional Canvas Group, and every module UI reference are assigned;
- Health Potion, Iron Sword, and Fire Wand resolve an
IconSprite; - every named Attribute uses the exact spelling and expected value type;
- Category Item View Set has a valid Empty Item View and unambiguous category mappings;
- Item View Drawer references that set and uses the intended Content;
- Item View Slot wraps the View when selection or clicking is required; and
- the Item View Slots Container is bound to the correct player’s Inventory.
Verify in Play Mode
- Open Bag and confirm that Health Potion, Iron Sword, and Fire Wand use the intended prefab and Icon.
- Add several Health Potions. Confirm that Amount Item View updates, then remove the stack and confirm that the empty slot does not retain its icon or amount.
- Move selection with every supported input method. Confirm that exactly one Item View shows its selected state and that submit or click reaches the parent container’s action flow.
- Equip Iron Sword. Confirm that its equipped presentation changes when its
ItemInfomoves to Equipment, while Fire Wand in Bag remains unequipped. - If Weapon has a distinct mapping, confirm that both weapons use it and Health Potion does not.
- Change one weapon’s runtime
Durability, refresh or redraw its View, and confirm that an Attribute module shows the new value without changing another weapon. - Open the shop or crafting panel when that prefab is shared there. Confirm that prices or required amounts use the correct owner context and fit the different layout.
- Replace an occupied slot with a different Item and confirm that name, Icon, amount, selection, equipment, Attribute, and conditional child states are all cleared before reuse.
Troubleshooting
| Symptom | Check | Fix |
|---|---|---|
| Slots exist but no Item View appears | Item View Drawer, Category Item View Set, mapping prefab, and Content | Assign the missing references and ensure the mapped prefab contains Item View. |
| An Item uses the wrong prefab | Its inherited categories and competing mappings | Keep one clear broad mapping and add only the necessary, more specific override. |
| Icon is blank or always uses the fallback | Icon Attribute type/value and Icon Image reference |
Supply a Sprite value and assign the module’s Image and Missing Icon intentionally. |
| A single Health Potion still shows an amount decoration | Hide Threshold and the two threshold-controlled GameObjects | Keep the threshold at 1 and assign the decoration to the correct side of the threshold. |
| Selection changes but the View does not | Item View Slot, Target Graphic, and selectable module references | Wrap the View in the active slot and assign the module’s selected and default visuals. |
| Equipped state never changes | IsEquipped, source Item Collection, and equipped collection identifier |
Use a valid boolean Attribute or preserve the source collection in ItemInfo. |
| Socket icons are mistaken for equipped state | The selected module | Use Equipped Item View for equipment; reserve Item Slots Item View for the Slots ItemAmounts Attribute. |
| Inventory amount or comparison is blank | Bound Inventory, Use Inventory ID, and collection names | Supply the correct Inventory context or use a valid identifier and collection names. |
| Old data remains after reuse | Every custom module’s Clear() behavior |
Reset all text, images, colors, child states, and cached values in Clear(). |
| A shop price is wrong | Raw Currency Attribute versus processed shop price | Let the Shop apply its context-specific price after the base View is drawn. |
| The View is clipped in one context | Preset, Rect Transform, and consuming slot size | Use a context-specific project prefab instead of forcing one oversized layout everywhere. |
Related pages
- Views, drawers, and category sets
- UI Designer Item View
- Item View Slot
- Item View Slots Container
- Inventory Grid
- Equipment collection View
- Item Shape Grid
- Attribute View
- Item Actions
- Customize generated UI
Customize modules and use the API
Create a custom module only when the focused shipped modules cannot express the required presentation. Inherit from ItemViewModule, update one concern in SetValue(ItemInfo), and reset every changed or cached state in Clear().
public sealed class DurabilityWarningItemView : ItemViewModule
{
[SerializeField] private GameObject m_Warning;
public override void SetValue(ItemInfo info)
{
var showWarning = info.Item != null &&
info.Item.TryGetAttributeValue<int>("Durability", out var durability) &&
durability <= 10;
m_Warning.SetActive(showWarning);
}
public override void Clear()
{
m_Warning.SetActive(false);
}
}
Implement IViewModuleSelectable when the module needs the View’s select state. Implement IItemViewSlotDropHoverSelectable only when the Item View Drop Handler should drive a drag-hover preview. Implement IInventoryDependent when an owning system must supply an Inventory; not every View host injects that dependency, so the module must be tested in each consuming context.
The Item View API exposes SetValue(ItemInfo), Clear(), Select(bool), Click(), Hide(bool), and Refresh(). An Item View Drawer also exposes before-drawing and after-drawing events for contextual presentation. These APIs update UI only; Item movement, Item Actions, saving, and networking remain the responsibility of their owning systems.