docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Gesture<T>

    A Gesture represents a sequence of touch events that are detected to represent a particular type of motion (e.g. Dragging, Pinching).

    Inheritance
    object
    Gesture<T>
    DragGesture
    PinchGesture
    TapGesture
    TwistGesture
    TwoFingerDragGesture
    Inherited Members
    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 abstract class Gesture<T> where T : Gesture<T>
    Type Parameters
    Name Description
    T

    The actual gesture.

    Remarks

    Gestures are created and updated by instances of GestureRecognizer<T>.

    Properties

    isCanceled

    (Read Only) A boolean value indicating whether the gesture was canceled.

    Declaration
    public bool isCanceled { get; }
    Property Value
    Type Description
    bool

    recognizer

    (Read Only) The gesture recognizer.

    Declaration
    protected GestureRecognizer<T> recognizer { get; }
    Property Value
    Type Description
    GestureRecognizer<T>

    targetObject

    (Read Only) The GameObject this gesture is targeting.

    Declaration
    public GameObject targetObject { get; protected set; }
    Property Value
    Type Description
    GameObject

    Methods

    CanStart()

    Returns true if this gesture can start.

    Declaration
    protected abstract bool CanStart()
    Returns
    Type Description
    bool

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

    Complete()

    Completes this gesture.

    Declaration
    protected void Complete()

    OnCancel()

    This method is called automatically when this gesture is canceled.

    Declaration
    protected abstract void 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 abstract void OnFinish()

    OnStart()

    This method is called automatically when this gesture is started.

    Declaration
    protected abstract void OnStart()

    UpdateGesture()

    Updates this gesture.

    Declaration
    protected abstract bool UpdateGesture()
    Returns
    Type Description
    bool

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

    Events

    onFinished

    Calls the methods in its invocation list when a gesture is finished.

    Declaration
    public event Action<T> onFinished
    Event Type
    Type Description
    Action<T>

    onStart

    Calls the methods in its invocation list when a gesture is started.

    Declaration
    public event Action<T> onStart
    Event Type
    Type Description
    Action<T>

    onUpdated

    Calls the methods in its invocation list when a gesture is successfully updated.

    Declaration
    public event Action<T> onUpdated
    Event Type
    Type Description
    Action<T>
    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)