Quick Start

Quick Start To Use Easy Drag and Drop Plugin

Drag and Drop Plugin Include 2 Main Core Script

DragObj - Drag this c# script into the UI Element to drag the element.

DropSlot - Drag this c# script into the UI Element to drop the Drag object

Example Drag and Drop GIf

- DragObj -

DropObj Set-up Variable Description

- Main Canvas Name -

The main canvas name of the drag object, this is require for the raycast pointer.

- Is Return Position -

True - the draggable object will return to it original position.

False - the draggable object will stay at the pointer drop position.

- Drop As First Sibling -

True - the draggable object will become a first sibling of the drop parent

False - the draggable object will be the last sibling of the drop parent.

- Obj Info Component -

A c# script component that containt the data structure of the draggable object. It will be store inside the DragObj and thus pass it to DropSlot for further usage.

- DropSlot -

DropSlot Set-up Variable Description

- Main Canvas Name -

The main canvas name of the drag object, this is require for the raycast pointer.

- Set Drop Obj Parent -

True - the draggable object change it parent to Parent Location

False - the draggable object will remain it original parent when drop.

- Set Drop Object Position -

True - the draggable object change it position to drop slot transform position

False - the draggable object will return to its original position

DropSlot Inherient

Luckily, You can easily inherient the DropSlot script for further usage.

Example of inherient script in the demo scene:

public class DropSlotDemo : DropSlot
    {
        public DataInfoDemo dataInfoDemo;
        public bool isOverrideOnDrop = true;
        public override void OnDrop(PointerEventData eventData)
        {
            base.OnDrop(eventData);
            if (!isOverrideOnDrop) return;
            var model = (DataInfoDemo) DropObj.m_ObjInfoComponent;
            dataInfoDemo.Initialize(model);
        }
    }

Last updated

Was this helpful?