Class PressInteraction | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class PressInteraction

    Performs the action at specific points in a button press-and-release sequence according top behavior.

    Inheritance
    System.Object
    PressInteraction
    Namespace: UnityEngine.InputSystem.Interactions
    Syntax
    public class PressInteraction : IInputInteraction
    Remarks

    By default, uses PressOnly which performs the action as soon as the control crosses the button press threshold defined by pressPoint. The action then will not trigger again until the control is first released.

    Can be set to instead trigger on release (i.e. when the control goes back below the button press threshold) using ReleaseOnly or can be set to trigger on both press and release using PressAndRelease).

    Note that using an explicit press interaction is only necessary if the goal is to either customize the press behavior of a button or when binding to controls that are not buttons as such (the press interaction compares magnitudes to pressPoint and thus any type of control that can deliver a magnitude can act as a button). The default behavior available out of the box when binding Button type actions to button-type controls (ButtonControl) corresponds to using a press modifier with behavior set to PressOnly and pressPoint left at default.

    Fields

    behavior

    Determines how button presses trigger the action.

    Declaration
    public PressBehavior behavior
    Field Value
    Type Description
    PressBehavior
    Remarks

    By default (PressOnly), the action is performed on press. With ReleaseOnly, the action is performed on release. With PressAndRelease, the action is performed on press and on release.

    pressPoint

    Amount of actuation required before a control is considered pressed.

    Declaration
    public float pressPoint
    Field Value
    Type Description
    System.Single
    Remarks

    If zero (default), defaults to defaultButtonPressPoint.

    Methods

    Process(ref InputInteractionContext)

    Declaration
    public void Process(ref InputInteractionContext context)
    Parameters
    Type Name Description
    InputInteractionContext context
    Implements
    IInputInteraction.Process(ref InputInteractionContext)

    Reset()

    Declaration
    public void Reset()
    Implements
    IInputInteraction.Reset()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023