Zum Hauptinhalt springen

Drag and Drop

Create the Payload​

The entry's native left-mouse handling detects a drag. UInventoryUIFunctionLibrary::DragDetected asks I_InventoryDragTarget to create a payload, creates UInventoryDragDropOperation, sets SourceInventory and Payload, and selects the drag visual. PayloadClass in project settings must be valid.

UInventoryPayload contains a snapshot of FRepInventoryData and PayloadTags. UInventoryDragDropOperation exposes source inventory information through I_DragDropOperation. Resolve the source slot from the payload's SlotID; DragDetected does not populate the operation's separate SourceSlot field.


Hover and Drop​

DragEnter and CanHoverAcceptPayload test exact tag compatibility and the target's CanAcceptPayload implementation. Entry UI uses bCanStack and a combined quantity check; it does not establish all server rules or even full item identity compatibility. Frame CanAcceptPayload returns true in the native implementation.

OnDrop performs basic operation/payload checks and returns whether the UI path accepts the drop. It does not repeat all hover checks, run a mutation or call an implemented plugin Server RPC. The entry/frame then broadcasts OnDropInSlotAccepted or OnDropAccepted on the local subsystem.


Connect the Project​

  1. Bind the subsystem drop delegates in your local player integration.
  2. Extract source/target tags, slot GUIDs and requested action/amount.
  3. Send those values through an owned Pawn/PlayerController Server RPC. Do not send the transient widget or drag operation object as authoritative state.
  4. On the server, resolve the current entries again and validate ownership, permissions, item compatibility and capacity.
  5. Execute a supported operation and let replicated state update the UI.

The frame includes visual prediction that can hide an entry before a server result. A rejected request producing no replicated slot change may not restore that visual automatically. Provide a project rejection response and refresh strategy. See UI Integration and Implementation Limits.