docs.unity3d.com
    Show / Hide Table of Contents

    Class InputHelpers

    Helper class for different kinds of input.

    Inheritance
    Object
    InputHelpers
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    [MovedFrom("")]
    public static class InputHelpers

    Methods

    IsPressed(InputDevice, InputHelpers.Button, out Boolean, Single)

    Checks whether button is pressed or not.

    Declaration
    public static bool IsPressed(this InputDevice device, InputHelpers.Button button, out bool isPressed, float pressThreshold = -1F)
    Parameters
    Type Name Description
    InputDevice device

    The input device.

    InputHelpers.Button button

    The button that is being checked.

    Boolean isPressed

    A boolean that will be true if button is pressed and false if not.

    Single pressThreshold

    The threshold of what defines a press.

    Returns
    Type Description
    Boolean

    Returns true if device and button are valid. Otherwise, returns false.

    TryReadSingleValue(InputDevice, InputHelpers.Button, out Single)

    Tries to read and return the supplied button value.

    Declaration
    public static bool TryReadSingleValue(this InputDevice device, InputHelpers.Button button, out float singleValue)
    Parameters
    Type Name Description
    InputDevice device

    The input device.

    InputHelpers.Button button

    The button to read the value.

    Single singleValue

    The button value; it will have the default langword_csharp_float value (0f) if the button value can't be read.

    Returns
    Type Description
    Boolean

    Returns true if the button value can be read. Otherwise, returns false

    Back to top
    Terms of use
    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