Scripting / UI
DropActionEventCaller
Lightweight drop zone that accepts dragged instructions and invokes callbacks. Used by InstructionModifierLayout as the target for dropping a child instruction.
Methods
| Method | Description |
|---|---|
AddDropEvent(System.Action<Action> callback) | Registers a callback to be invoked with the dropped Action when a drag lands on this drop zone. Multiple callbacks can be registered; all are called in registration order. |
OnDrop(PointerEventData) | IDropHandler implementation — sets DragAndDrop.dragCaptured = true and invokes all registered callbacks with the dragged Action. |
Usage Example
// On a GameObject with a DropActionEventCaller component:
[SerializeField] DropActionEventCaller dropZone;
void Start()
{
dropZone.AddDropEvent(OnInstructionDropped);
}
void OnInstructionDropped(Action action)
{
PlayerInstruction instruction = action.CreateInstruction();
// do something with the instruction
}
See also: DragAndDrop, InstructionModifierLayout