How-To: Drag & Drop
Goal: drag an item from one widget and drop it on another, carrying a typed UObject payload.
Prerequisites
Source and target widgets. Drag-drop uses the standard UMG overrides (
OnMouseButtonDown / OnDragDetected / OnDrop); CrimsonUI supplies the operation class.1. Create the operation on drag
Screenshot pending
Images/CrimsonUI/howto-dragdrop-detect-bp.png2. Read the payload on drop
Screenshot pending
Images/CrimsonUI/howto-dragdrop-drop-bp.pngTyped subclasses
Domain plugins subclass
UCrimsonDragDropOperation and add strongly-typed properties (CrimsonCore's inventory does exactly this). SetPayloadObject / GetPayloadObject are both Blueprint-callable; GetPayload<T>() is the C++ typed shortcut.Verify
Dragging shows your drag visual; dropping on the target delivers the exact UObject you set; dropping elsewhere cancels harmlessly.
See also
- How-To: Lists with Mixed Item Types - the entries you usually drag.