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

    Class InputSystem

    Inheritance
    System.Object
    InputSystem
    GLFWInputSystem
    HTMLInputSystem
    Namespace: Unity.Tiny.Input
    Syntax
    public class InputSystem : ComponentSystem

    Fields

    m_inputState

    Declaration
    protected InputData m_inputState
    Field Value
    Type Description
    InputData

    Methods

    GetInputPosition()

    Returns the input position in screen pixels. For touch input this is the first touch. For mouse input, it is the mouse position.

    Declaration
    public float2 GetInputPosition()
    Returns
    Type Description
    float2

    GetKey(KeyCode)

    Returns true if the key is currently held down.

    Declaration
    public bool GetKey(KeyCode key)
    Parameters
    Type Name Description
    KeyCode key
    Returns
    Type Description
    System.Boolean

    GetKeyDown(KeyCode)

    Returns true if the key was pressed in the current frame.

    Declaration
    public bool GetKeyDown(KeyCode key)
    Parameters
    Type Name Description
    KeyCode key
    Returns
    Type Description
    System.Boolean

    GetKeyUp(KeyCode)

    Returns true if the key was released in the current frame.

    Declaration
    public bool GetKeyUp(KeyCode key)
    Parameters
    Type Name Description
    KeyCode key
    Returns
    Type Description
    System.Boolean

    GetMouseButton(Int32)

    Returns true if the mouse button is currently held down.

    Declaration
    public bool GetMouseButton(int button)
    Parameters
    Type Name Description
    System.Int32 button
    Returns
    Type Description
    System.Boolean

    GetMouseButtonDown(Int32)

    Returns true if the mouse button was pressed in the current frame.

    Declaration
    public bool GetMouseButtonDown(int button)
    Parameters
    Type Name Description
    System.Int32 button
    Returns
    Type Description
    System.Boolean

    GetMouseButtonUp(Int32)

    Returns true if the mouse button was released in the current frame.

    Declaration
    public bool GetMouseButtonUp(int button)
    Parameters
    Type Name Description
    System.Int32 button
    Returns
    Type Description
    System.Boolean

    GetTouch(Int32)

    Retrieves information for a specific touch point. The index ranges from 0 to the value returned by TouchCount.

    Declaration
    public Touch GetTouch(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    Touch

    GetWorldInputPosition()

    Convenience function that returns the value from GetInputPosition transformed into world space. World space includes the camera transform of the camera closest to the input position. This is the same as TranslateScreenToWorld(GetInputPosition()); In 2D setups, the world z coordinate is always set to 0.

    Declaration
    public float3 GetWorldInputPosition()
    Returns
    Type Description
    float3

    IsMouseEmulated()

    Returns true if mouse events are emulated by other input devices, such as touch.

    Declaration
    public bool IsMouseEmulated()
    Returns
    Type Description
    System.Boolean

    IsMousePresent()

    Returns true if the current device produces mouse input.

    Declaration
    public bool IsMousePresent()
    Returns
    Type Description
    System.Boolean

    IsTouchSupported()

    Returns true if the current device produces touch input responses. This value may not be accurate until a first touch occurs.

    Declaration
    public bool IsTouchSupported()
    Returns
    Type Description
    System.Boolean

    OnCreate()

    Declaration
    protected override void OnCreate()

    OnDestroy()

    Declaration
    protected override void OnDestroy()

    OnUpdate()

    Declaration
    protected override void OnUpdate()

    TouchCount()

    Returns the number of currently active touches.

    Declaration
    public int TouchCount()
    Returns
    Type Description
    System.Int32

    TranslateScreenToWorld(float2)

    Transforms Screen coordinates into World coordinates. World space includes the camera transform of the camera closest to the input coordinate. In 2D setups, the world z coordinate is always set to 0.

    Declaration
    public float3 TranslateScreenToWorld(float2 screenCoord)
    Parameters
    Type Name Description
    float2 screenCoord
    Returns
    Type Description
    float3
    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