Class DragAndDrop
Add this DimSum to a GameObject to enable click and drag. If the GameObject is not part of the Unity UI system it needs to have a Collider attached.
Inheritance
Implements
Namespace: Alegra.DimSums
Assembly: cs.temp.dll.dll
Syntax
public class DragAndDrop : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
Fields
onDragStarted
Fired when dragging starts.
Declaration
public UnityEvent onDragStarted
Field Value
Type | Description |
---|---|
UnityEvent |
onDropSuccess
Fired when dragging ends in a drop zone.
Declaration
public UnityEvent onDropSuccess
Field Value
Type | Description |
---|---|
UnityEvent |
onSlideHomeEnded
Fired when the object has finished sliding home (e.g. when it was dropped outside of a dropzone).
Declaration
public UnityEvent onSlideHomeEnded
Field Value
Type | Description |
---|---|
UnityEvent |
onSlideHomeStarted
Fired when the object has started sliding home (e.g. when it was dropped outside of a dropzone or when SlideHome() is called).
Declaration
public UnityEvent onSlideHomeStarted
Field Value
Type | Description |
---|---|
UnityEvent |
Methods
DisableDrop()
Call this when the object is no longer in a valid drop location e.g. You can use the CollisionEvent DimSum OnExit to call this method.
Declaration
public void DisableDrop()
EnableDrop()
Call this when the object enters a valid drop zone. e.g. You can use the CollisionEvent DimSum OnEnter to call this method.
Declaration
public void EnableDrop()
OnPointerDown(PointerEventData)
This will be called automatically by Unity.
Declaration
public void OnPointerDown(PointerEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
PointerEventData | eventData | Passed automatically by Unity. |
OnPointerUp(PointerEventData)
This will be called automatically by Unity.
Declaration
public void OnPointerUp(PointerEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
PointerEventData | eventData |
SlideHome()
This method will cause the object to slide back to the location where the drag originated. This method is called automatically when the oject is dropped at an invalid location.
Declaration
public void SlideHome()