Use an Item Shape Grid for a finite Bag whose Items occupy differently sized groups of cells. It combines an ItemShape Attribute, Inventory-side placement data, layered UI and shape-aware movement. A conventional Inventory Grid is enough for equal-sized slots; Equipment remains a separate named-slot collection/view.

Prepare shapes and create Bag

Use Edit Mode with the selected Database, Canvas Managers and a validated project-owned schema. The RPG schema is a spatial starting point. Follow UI Designer setup for the foundation and recommended Spawn In Scene action.

  1. In the Item Category editor, declare Shape as ItemShape in the Item Definition Attribute collection on the appropriate shared category.
  2. Give Health Potion one enabled cell, Iron Sword a taller shape, and Fire Wand a distinct shape. Place each anchor on an enabled cell; it aligns to the destination cell during placement.
  3. Ensure controller and view modules read the same exact Attribute name, initially Shape.
  4. Open UI Designer > Item Shape Grid and assign Parent Transform beneath the intended Display Panel Manager.
  5. Choose Panel Option: Simple is the initial default; Floating supplies a movable panel. For a Main Menu inner panel, use its exact Main Content transform.
  6. Set Panel Name, Grid Name, player Inventory, Grid Size and Item Shape Size. The last two initially use 8×8 cells and 100×100 pixels per cell.
  7. Under Item Collection, choose Bag, then select Create.
  8. Inspect the generated Item Shape Grid Controller/Data beside the Inventory and verify Item Collections contains Bag. For all Inventory collections, use an empty Item Collections list after creation.

The creator connects the UI to a grid-data ID. A name helps identify the panel; the ID resolves its placement data.

A runtime Item Shape Grid displaying differently sized Item icons across a finite set of cells.

Match UI and data

Connection Check
Bound Inventory Contains the intended Item Shape Grid Controller and Data.
Item Shape Grid Data ID Matches that data entry’s ID, especially with several grids on one Inventory.
Data Item Collections Bag scope, with Equipment excluded for this example.
Grid Size Identical cell dimensions on UI and data.
Item Shape Size Matching UI cell size across foreground/background geometry.
Item Shape View Content Foreground content holding the complete Item visuals.
Item View Drawer Content Background Item View Slots, one per cell.

Use UI Designer’s connected size controls and recheck data/layout after resizing. Give multiple grids distinct IDs and deliberate collection/filter scopes. The runtime grid guide owns placement/data APIs.

Inspect a native spatial Bag

The native Bag Shape Grid below uses data ID 0, 5 columns × 5 rows and 100 × 100 pixel cells. UI Designer connects it to the Inventory-side data entry.

UI Designer selects Bag Shape Grid and shows data ID zero, five columns, five rows and one hundred by one hundred pixel cells.

On Player Inventory, the controller reads Shape. The data entry uses ID 0, the same 5 × 5 dimensions and only Bag; Smart Two Way Move stays off. The copied schema supplies the shape-specific Views and their configured ShapeIcon/backup Icons.

Player Inventory has an Item Shape Grid Controller reading Shape and a five by five data grid with ID zero, Bag as its only collection and Smart Two Way Move disabled.

The matching runtime example checks three footprints, stacking and valid/rejected moves with this setup.

Retain the two-layer Views

The background receives cell input and selection/drop feedback. The foreground presents one coherent Item visual across its complete shape; its Canvas Group should allow background interaction.

Module Role
Item Shape Item View Shape-based size/position and foreground/background roles.
Item Shape Drop Preview Item View Valid/invalid placement feedback across the shape.
Item Shape Selected Item View Highlights the selected Item’s occupied cells.
Item Shape Rect Placer Item View Positions child RectTransforms, such as amounts, within irregular shapes.
Canvas Group Foreground visibility/interaction configuration; foreground raycasts must not block background slots.

Keep compatible shape-specific Views when customizing; ordinary one-cell Views do not supply those combined roles.

Connect movement rules

Configure the canvas cursor manager, Item View Drop Handler and drop action set. Add a pointer Drag Handler or keyboard/controller Move Cursor through the movement guide.

Use the matching condition/action for each operation:

Operation Condition and action
Reposition inside the same grid ItemViewDropContainerCanMoveCondition and ItemViewDropMoveIndexAction; the grid validates and moves its placement data.
Drop from another container into a shape grid ItemViewShapeDropCondition and ItemViewShapeDropAction; validate the full destination shape and any exchange.

Keep previews and final placement connected to the same grid/data. Verify any configured exchange behavior separately from empty-cell movement.

Verify in Play Mode

Open Bag and check the three Item shapes, Icons and amounts. Select each Item: its background cells should highlight while its foreground Icon remains coherent. Move Iron Sword to free space and compare preview/final occupied cells; test grid edges and disallowed overlaps. Fit the potion into a one-cell gap and verify anchor alignment.

Repeat through each supported input route. Equip the sword and verify it leaves Bag without residual occupied cells. Close/reopen and check current positions. At the smallest supported resolution, inspect panel bounds, labels, shapes and focus for clipping.

For an empty grid, inspect Inventory, data ID, collection scope and Attribute names. For offset shapes or missing feedback, inspect anchors, dimensions, both content transforms and the corresponding view modules/condition/action.