Item View Slot
An Item View Slot wraps one Item View in a selectable, clickable and draggable control. It presents the ItemInfo supplied by its container; Inventory ownership, actions and transfers remain with the surrounding systems.
Configure a generated slot
- Create the intended container through UI Designer and select one of its Item View Slot children.
- Assign one valid Item View, or keep one discoverable beneath the slot for initialization. Its Target Graphic becomes the slot’s Action Button target, and the View receives this slot as its context.
- Add the presentation modules needed by the panel: for example Icon, Amount and Select Image for Bag, with an equipped marker for Equipment. Keep the Item View Slot as the interaction owner.
- Configure the inherited Unity Selectable transition, interactability and Navigation. Connect each supported direction in the final runtime hierarchy and give selection a visible graphic or module state.
- Configure pointer/activation options below, then add any restrictions before Play Mode.
- Put Item Action and description bindings on the owning Item View Slots Container. A standard action flow uses its events rather than requiring a custom slot UnityEvent.

| Field | Default | Effect |
|---|---|---|
| Item View | None on a manually added slot | Assigned visual child, otherwise found during Awake. |
| Index | 0 |
Local index reassigned by the container during initialization; changing it does not reorder Inventory data. |
| Disabled And Selected Sprite / Disabled And Selected Color | None / Gray | Selected-but-noninteractable appearance for sprite/color transitions. |
| On Click Event | Empty | Optional UnityEvent when Action Button Press completes. |
| On Pointer Click Input Button | Left | Mouse buttons allowed to press the control. |
| Select On Pointer Enter / Deselect On Pointer Exit | On / On | Pointer-driven selection when entering/leaving. |
| Unselected Press Selects And Press | Off | A Press reaching an unselected control selects without submitting. Enable to do both; normal left pointer-down selection usually happens before click. |
EventSystem selection calls ItemView.Select(true) and deselection sends false. Selectable modules can change sprites, child objects or events alongside the Action Button transition. Configure both so they communicate the same state. Clicking/submitting invokes the container’s activation path and the View’s clickable modules; selection alone can update a description without using the item.
Add slot restrictions
Add Item View Slot Category Restriction or Item View Slot Definition Restriction on the slot’s GameObject. Assign a category/definition from the active database. Inherently starts enabled, allowing compatible descendants: a Weapon slot can accept a sword while rejecting a potion.
Every attached restriction must accept the candidate. Empty values and an unconfigured category/definition are accepted so the slot can clear. Restrictions are cached during Awake; configure them before initialization or supply a custom refresh path for runtime changes.
The containing view’s add/move checks or drop conditions must call the restriction checks. Direct SetItemInfo changes presentation without validating restrictions or transferring Inventory data. Use the specialized container or Inventory transaction for actual item changes.
Connect actions, descriptions and movement
| Interaction | Configure on the container | Result |
|---|---|---|
| Select an item | Description binding; Draw On Select and Draw On Container Draw default on. | Description follows the current slot value. Draw On Click starts off. |
| Click/submit | Item Action binding; Use Item On Click defaults on. | Opens an action panel or invokes the configured action index. |
| Pointer drag | Cursor Manager, Drop Handler, Drop Action Set and Drag Handler. | Previews movement and executes a validated drop. |
| Keyboard/controller movement | Same cursor/drop setup plus Move Cursor. | Selects and confirms a destination without pointer dragging. |
Follow Move Items for the transaction setup. A rejected destination should leave the source item intact. The cursor visual is a preview, and direct visual assignment is not an Inventory move.
The container subscribes to slot events and supplies Inventory/panel context; the slot has no serialized Inventory owner. For local multiplayer, use the intended player’s Display Panel Manager, EventSystem and input. Test pointer, keyboard and controller against that ownership.
Verify selection and restrictions
Open Bag and navigate between a potion, sword and empty slot. Confirm one clear selected state, description updates on selection, and one action on activation. Replacing or clearing a selected value must remove stale icon/amount data and refresh its selection presentation.
Reject the potion from a Weapon-restricted Equipment slot, then move the sword into it through the data transaction. Both containers should redraw correctly. Begin/cancel a drag and navigate again; no cursor preview or stale highlight should remain.
| Symptom | Check | Fix |
|---|---|---|
| Draw/click fails | Item View reference and hierarchy. | Assign a valid View before initialization. |
| Selection is invisible | Target Graphic, transition and selectable modules. | Configure visible states on the assigned graphics. |
| First activation only selects | Unselected Press Selects And Press. | Enable it when one press should also activate. |
| Forbidden item appears | Direct visual assignment versus validated movement. | Check CanContain and use the owning data transaction. |
| Navigation skips/leaves the panel | Navigation links and active hierarchy. | Rebuild or explicitly connect neighbors after layout changes. |
Save Inventory, collection and assignment data through the relevant savers, then redraw local slots. Index, selection, pointer state and pending drags are transient. Networking must synchronize authoritative data changes rather than a slot icon or direct SetItemInfo call.
Developer reference
Use this API for view state and restrictions:
itemViewSlot.SetItemView(itemView);
itemViewSlot.AssignIndex(localIndex);
if (itemViewSlot.CanContain(itemInfo)) {
itemViewSlot.SetItemInfo(itemInfo);
}
SetItemInfo clears null/empty-ID items. SetItemView connects the target graphic and slot context; DisableImage disables the slot Image, and UpdateUI reapplies the slot reference. A reassignment to a selected slot replays selection notification.
Action Button publishes submit, select/deselect, cancel, move, pointer and drag/drop events. Prefer the container’s higher-level OnItemViewSlotSelected, OnItemViewSlotDeselected, OnItemViewSlotClicked and movement events for shared bindings. Their ItemViewSlotEventData contains container, slot, View, ItemInfo, local SlotIndex, SlotIndexOffset and combined ItemIndex; pointer data adds the original event and pointer ID. Treat these as transient event state.
For a custom rule, inherit ItemViewSlotRestriction, implement CanContain(ItemInfo) and attach before Awake. Keep authoritative validation in the specialized container or Inventory layer.