extends MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
Denotes a Unity UI Element as being draggable on the UI Canvas.
If a UI Draggable item is set to
Restrict To Drop Zone = truethen the UI Draggable item must be a child of an element that has the VRTK_UIDropZone script applied to it to ensure it starts in a valid drop zone.
- Place the
VRTK_UIDraggableItemscript on the Unity UI element that is to be dragged.
- Restrict To Drop Zone: If checked then the UI element can only be dropped in valid a VRTK_UIDropZone object and must start as a child of a VRTK_UIDropZone object. If unchecked then the UI element can be dropped anywhere on the canvas.
- Restrict To Original Canvas: If checked then the UI element can only be dropped on the original parent canvas. If unchecked the UI element can be dropped on any valid VRTK_UICanvas.
- Forward Offset: The offset to bring the UI element forward when it is being dragged.
public GameObject validDropZone- The current valid drop zone the dragged element is hovering over.
DraggableItemDropped- Emitted when the draggable item is successfully dropped.
DraggableItemReset- Emitted when the draggable item is reset.
VRTK_UIDraggableItem_UnityEvents component to
VRTK_UIDraggableItem object allows access to
UnityEvents that will react identically to the Class Events.
- All C# delegate events are mapped to a Unity Event with the
GameObject target- The target the item is dragged onto.
VRTK/Examples/034_Controls_InteractingWithUnityUI demonstrates a collection of UI elements that are draggable
Updated less than a minute ago