docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class DragGesture

    Gesture for when the user performs a drag motion on the touch screen.

    Inheritance
    object
    Gesture<DragGesture>
    DragGesture
    Inherited Members
    Gesture<DragGesture>.onStart
    Gesture<DragGesture>.onUpdated
    Gesture<DragGesture>.onFinished
    Gesture<DragGesture>.isCanceled
    Gesture<DragGesture>.targetObject
    Gesture<DragGesture>.recognizer
    Gesture<DragGesture>.Complete()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.Interaction.Toolkit.AR
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    public class DragGesture : Gesture<DragGesture>

    Constructors

    DragGesture(DragGestureRecognizer, Touch)

    Initializes and returns an instance of DragGesture.

    Declaration
    public DragGesture(DragGestureRecognizer recognizer, Touch touch)
    Parameters
    Type Name Description
    DragGestureRecognizer recognizer

    The gesture recognizer.

    Touch touch

    The touch that started this gesture.

    DragGesture(DragGestureRecognizer, Touch)

    Initializes and returns an instance of DragGesture.

    Declaration
    public DragGesture(DragGestureRecognizer recognizer, Touch touch)
    Parameters
    Type Name Description
    DragGestureRecognizer recognizer

    The gesture recognizer.

    Touch touch

    The touch that started this gesture.

    Properties

    delta

    (Read Only) The delta screen position of the gesture.

    Declaration
    public Vector2 delta { get; }
    Property Value
    Type Description
    Vector2

    dragRecognizer

    (Read Only) The gesture recognizer.

    Declaration
    protected DragGestureRecognizer dragRecognizer { get; }
    Property Value
    Type Description
    DragGestureRecognizer

    fingerId

    (Read Only) The id of the finger used in this gesture.

    Declaration
    public int fingerId { get; }
    Property Value
    Type Description
    int

    position

    (Read Only) The current screen position of the gesture.

    Declaration
    public Vector2 position { get; }
    Property Value
    Type Description
    Vector2

    startPosition

    (Read Only) The screen position where the gesture started.

    Declaration
    public Vector2 startPosition { get; }
    Property Value
    Type Description
    Vector2

    Methods

    CanStart()

    Returns true if this gesture can start.

    Declaration
    protected override bool CanStart()
    Returns
    Type Description
    bool

    Returns true if the gesture can start. Otherwise, returns false.

    Overrides
    Gesture<DragGesture>.CanStart()

    OnCancel()

    This method is called automatically when this gesture is canceled.

    Declaration
    protected override void OnCancel()
    Overrides
    Gesture<DragGesture>.OnCancel()
    Remarks

    When canceled, this method is called right before OnFinish(), which is still invoked.

    OnFinish()

    This method is called automatically when this gesture is finished.

    Declaration
    protected override void OnFinish()
    Overrides
    Gesture<DragGesture>.OnFinish()

    OnStart()

    This method is called automatically when this gesture is started.

    Declaration
    protected override void OnStart()
    Overrides
    Gesture<DragGesture>.OnStart()

    UpdateGesture()

    Updates this gesture.

    Declaration
    protected override bool UpdateGesture()
    Returns
    Type Description
    bool

    Returns true if the update was successful. Otherwise, returns false.

    Overrides
    Gesture<DragGesture>.UpdateGesture()
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)