Interactable Slots

Use slots to drag items between specific cells in a Grid or Table. Items can occupy multiple cells, swap with another item, or replace it and pick it up.

The SpaceInventorySample scene, in Samples/SpaceAdventure/Scenes.

Set up an inventory

  1. Add a Grid or Table Layout and a Flexalon Drag Target to the inventory parent.
  2. Add Flexalon Interactable to each item and enable Draggable. Configure a collider for 3D items, or a raycast-enabled Graphic and EventSystem for UI.
  3. Add Flexalon Cell to items that need a particular location or span. Use Column Span and Row Span for larger inventory items.
  4. Choose a slot Placement Mode on each interactable. Start with Nearest Open Slot to prevent drops onto occupied cells.
  5. Choose an Invalid Drop Mode. Return To Start is useful when an item must remain in the inventory.

Use Capture Current Cell on automatically placed items when they should keep their positions as other items move. See Cells and Rows for placement and overlap settings.

Placement modes

ModeBehavior
Nearest SlotUse the nearest overlapping slot, allowing the layout's placement rules to shift other items.
Nearest Open SlotUse the nearest overlapping slot with space for the item's entire span.
First Open SlotUse the first open placement in layout order, without requiring the pointer to overlap that slot.
Swap Nearest SlotUse an open slot, or trade places with the item already there if both fit. For example, dropping a 1×1 potion onto a 2×1 sword moves the sword to where the potion started, shifting it over if it needs more room.
Replace Nearest SlotUse an open slot, or drop the item and pick up the one already there. You then carry the picked-up item until you click again to place it.

Nearest Sibling, Start, and End place items by sibling order. Choose those modes for lists where you want the layout to reflow instead of assigning specific cells.

Invalid drops

Invalid Drop ModeBehavior
NoneEnd the drag and leave the item where it is. This is the default.
Return To StartRestore the starting parent and placement. Normal collision rules apply if the original slot has become occupied.
Continue DragKeep dragging until another click attempts placement.

An item picked up by Replace Nearest Slot uses its own Invalid Drop Mode. If it returns to its start, the item that replaced it stays where it was dropped. With external input, Continue Drag behaves like None, and Replace Nearest Slot doesn't pick up the other item.

Restrict placement

Use SlotFilter to reject candidate slots based on your game's rules, such as equipment type. Fit and occupancy checks still apply. Use DragTargetFilter or the target's InteractableFilter to restrict which inventories accept an item.

To highlight where an item will land while it's being dragged, read the interactable's DragSlot. During a swap, DragSwapSlot shows where the other item will go.

Interactable setup and options · Slot API reference