Scripting / UI
DragAndDrop
Implements Unity's drag-and-drop handlers to enable reordering instructions on the instruction sheet. Manages ghost copies during drags and communicates with InstructionSheet and drop zones.
Static State
| Member | Type | Description |
|---|---|---|
currentDragging | DragAndDrop | The component currently being dragged, or null if no drag is in progress. Read by drop handlers to retrieve the associated Action. |
dragCaptured | bool | Set to true by a drop handler when it accepts the drag. If false when the drag ends, the ghost copy is destroyed. |
dragging | bool | true while a drag is in progress. Other systems check this flag to suppress hover effects. |
Inspector Fields
| Field | Type | Description |
|---|---|---|
leaveInstance | bool | When true, a copy of the original stays in the palette while the ghost follows the cursor. When false, the original itself is dragged and returns if the drop is cancelled. |
audioSource | AudioSource | AudioSource for drag SFX. |
dragStartSound | AudioClip | Clip played when the drag begins. |
dragEndSound | AudioClip | Clip played when the drag ends (captured or not). |
Drag Lifecycle
| Phase | What happens |
|---|---|
OnBeginDrag | If leaveInstance is true a copy is created at the original position. The dragged object is reparented to the canvas root, its alpha is set to 0.7, and raycasts are disabled so the pointer can reach drop zones beneath it. currentDragging, dragging, and dragCaptured are set. |
OnDrag | The ghost follows the cursor. InstructionSheet updates its insert indicator based on which layout the pointer is over. |
OnEndDrag | Alpha and raycasts are restored. If dragCaptured is false the ghost is destroyed. Static state is reset. |
See also: DropActionEventCaller, InstructionSheet