docs.unity.cn
    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
    Namespace: UnityEngine.XR.Interaction.Toolkit.AR
    Syntax
    public abstract class Gesture<T> : object 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
    Boolean

    m_Recognizer

    (Read Only) The gesture recognizer.

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

    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

    TargetObject

    (Read Only) The GameObject this gesture is targeting.

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

    WasCancelled

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

    Declaration
    public bool WasCancelled { get; }
    Property Value
    Type Description
    Boolean

    Methods

    CanStart()

    Returns true if this gesture can start.

    Declaration
    protected abstract bool CanStart()
    Returns
    Type Description
    Boolean

    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
    Boolean

    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>
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on Wednesday, October 27, 2021