DragSource
Marks a node as something a pointer can pick up and carry, such as an item out of a bag. Kind is matched against a Drop Target's accepted list, Preview names a node drawn under the pointer, and Disabled stops pick-ups. Goes under a Canvas.
On this page
Add it
Add component → DragSourceComponent in the Inspector, on the node that should carry it.
From a script
A script on the same node writes these fields by name. DragSourceComponent is the name to pass.
rgs
set_text("DragSourceComponent", "action", "");
set_text("DragSourceComponent", "kind", "item");
set_text("DragSourceComponent", "preview", "");
set_flag("DragSourceComponent", "disabled", false); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Action | action | text | empty | Reported when a drag from here ends: 1 if it landed, 0 if it came back; a slot that is also a drop target needs a different action on each end, since one action cannot tell an item arriving here from this slot's own item landing. |
| Kind | kind | text | item | Matched against a drop target's accepted kinds. |
| Payload | payload | text | empty | The thing itself: an item id, a slot number, whatever the game means. |
| Preview | preview | text | empty | Node to draw under the pointer while dragging. |
| Disabled | disabled | checkbox | off | When on, this cannot be picked up, so a press on it is only a press. |