docs.unity3d.com
    目次を表示する/隠す

    Class PressInteraction

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

    Inheritance
    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 (that is, 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
    [Tooltip("Determines how button presses trigger the action. 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 release.")]
    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
    [Tooltip("The amount of actuation a control requires before being considered pressed. If not set, default to 'Default Press Point' in the global input settings.")]
    public float pressPoint
    Field Value
    Type Description
    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()
    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)