Class DraggableUI
- Namespace
- Fallencake.UI
- Assembly
- Fallencake.UI.dll
Enables dragging of a target UnityEngine.RectTransform within a defined drag area. Provides events for drag lifecycle and optional bring-to-front behavior.
[AddComponentMenu("Modular UI/Draggable UI")]
public class DraggableUI : UIBehaviour
- Inheritance
-
objectObjectComponentBehaviourMonoBehaviourUIBehaviourDraggableUI
Properties
DragArea
Bounds within which dragging is clamped. Defaults to top-most parent UnityEngine.RectTransform.
public RectTransform DragArea { get; }
Property Value
- RectTransform
DragTransform
The transform that will be moved by this component. Defaults to own UnityEngine.RectTransform.
public RectTransform DragTransform { get; }
Property Value
- RectTransform
IsDragOnTop
If true, moves the dragged transform to the top of the hierarchy during drag.
public bool IsDragOnTop { get; set; }
Property Value
- bool
OnDragEnded
Event called when drag ends
public UnityEvent OnDragEnded { get; }
Property Value
- UnityEvent
OnDragStarted
Event called when drag starts
public UnityEvent OnDragStarted { get; }
Property Value
- UnityEvent
OnDragging
Event called every frame during drag
public UnityEvent OnDragging { get; }
Property Value
- UnityEvent
Methods
OnBeginDrag(PointerEventData)
Called by a BaseInputModule before a drag is started.
public void OnBeginDrag(PointerEventData data)
Parameters
dataPointerEventData
OnDrag(PointerEventData)
When dragging is occurring this will be called every time the cursor is moved.
public void OnDrag(PointerEventData data)
Parameters
dataPointerEventData
OnEndDrag(PointerEventData)
Called when drag operation ends.
public void OnEndDrag(PointerEventData data)
Parameters
dataPointerEventDataPointer event data.
Start()
public void Start()