docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IGestureRecognizer

    Interface for gesture recognizers.

    A gesture recognizer decouples the logic for recognizing a sequence of touches (or other input) and acting on that recognition. When one of these objects recognizes a common gesture or, in some cases, a change in the gesture, it sends an action message to each designated target object.

    Namespace: Unity.AppUI.Core
    Assembly: Unity.AppUI.dll
    Syntax
    public interface IGestureRecognizer

    Properties

    hasChangedThisFrame

    Whether the gesture recognizer state or outgoing value has changed this frame.

    Declaration
    bool hasChangedThisFrame { get; }
    Property Value
    Type Description
    bool

    state

    The current state of the gesture recognizer.

    The possible states a gesture recognizer can be in are represented by the values of type.

    GestureRecognizerState.

    Some of these states aren’t applicable to discrete gestures.

    Declaration
    GestureRecognizerState state { get; }
    Property Value
    Type Description
    GestureRecognizerState

    Methods

    Recognize(ReadOnlySpan<AppUITouch>)

    Main method to recognize a gesture.

    A concrete implementation of a gesture recognizer should override this method to recognize a gesture. The implementation should also assume that this method will be called every frame.

    Declaration
    void Recognize(ReadOnlySpan<AppUITouch> appuiTouches)
    Parameters
    Type Name Description
    ReadOnlySpan<AppUITouch> appuiTouches

    The current touch inputs for the current frame.

    Remarks

    Sometimes, touch inputs can be lost from a frame to another (no AppUITouch event with an Ended or Canceled phase will be sent). The concrete implementation must aknowledge this and reset its state accordingly.

    Reset()

    Resets the gesture recognizer to its initial state.

    Declaration
    void Reset()
    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)