Class InputSystem | Project Tiny | 0.28.0-preview.40
docs.unity3d.com
    Show / Hide Table of Contents

    Class InputSystem

    Inheritance
    Object
    InputSystem
    HybridInputSystem
    Namespace: Unity.Tiny.Input
    Syntax
    public class InputSystem : SystemBase

    Fields

    m_inputState

    Declaration
    protected InputData m_inputState
    Field Value
    Type Description
    InputData

    Properties

    CompensateForScreenOrientation

    If this setting is enabled, rotation values reported by sensors are rotated around the Z axis as follows: for devices with natural Portrait orientation ScreenOrientation.Portrait - values remain unchanged. ScreenOrientation.PortraitUpsideDown - values rotate by 180 degrees. ScreenOrientation.LandscapeLeft - values rotate by 90 degrees. ScreenOrientation.LandscapeRight - values rotate by 270 degrees. for devices with natural Landscape orientation ScreenOrientation.LandscapeRight - values remain unchanged. ScreenOrientation.Portrait - values rotate by 270 degrees. ScreenOrientation.PortraitUpsideDown - values rotate by 90 degrees. ScreenOrientation.LandscapeLeft - values rotate by 180 degrees. This setting is enabled by default.

    Declaration
    public bool CompensateForScreenOrientation { get; set; }
    Property Value
    Type Description
    Boolean

    Methods

    CreateSensor(ComponentType)

    Declaration
    protected virtual Sensor CreateSensor(ComponentType type)
    Parameters
    Type Name Description
    ComponentType type
    Returns
    Type Description
    Sensor

    DisableSensor<T>()

    Declaration
    public void DisableSensor<T>()
        where T : struct, IComponentData
    Type Parameters
    Name Description
    T

    EnableSensor<T>()

    Declaration
    public void EnableSensor<T>()
        where T : struct, IComponentData
    Type Parameters
    Name Description
    T

    GetInputDelta()

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

    Declaration
    public float2 GetInputDelta()
    Returns
    Type Description
    Unity.Mathematics.float2

    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
    Unity.Mathematics.float2

    GetInputScrollDelta()

    Returns the current input scroll delta in screen pixels for this frame.

    Declaration
    public float2 GetInputScrollDelta()
    Returns
    Type Description
    Unity.Mathematics.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
    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
    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
    Boolean

    GetMouseButton(Int32)

    Returns true if the mouse button is currently held down.

    Declaration
    public bool GetMouseButton(int button)
    Parameters
    Type Name Description
    Int32 button
    Returns
    Type Description
    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
    Int32 button
    Returns
    Type Description
    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
    Int32 button
    Returns
    Type Description
    Boolean

    GetMouseMode()

    Returns the current mouse pointer type.

    Declaration
    public virtual PointerModeType GetMouseMode()
    Returns
    Type Description
    PointerModeType

    GetRotationIndex(ScreenOrientation)

    Declaration
    protected virtual int GetRotationIndex(ScreenOrientation orientation)
    Parameters
    Type Name Description
    ScreenOrientation orientation
    Returns
    Type Description
    Int32

    GetSensorSamplingFrequency<T>()

    Declaration
    public int GetSensorSamplingFrequency<T>()
        where T : struct, IComponentData
    Returns
    Type Description
    Int32
    Type Parameters
    Name Description
    T

    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
    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
    Unity.Mathematics.float3

    IsAvailable(ComponentType)

    Declaration
    protected virtual bool IsAvailable(ComponentType type)
    Parameters
    Type Name Description
    ComponentType type
    Returns
    Type Description
    Boolean

    IsAvailable<T>()

    Declaration
    public bool IsAvailable<T>()
        where T : struct, IComponentData
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    IsMouseEmulated()

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

    Declaration
    public bool IsMouseEmulated()
    Returns
    Type Description
    Boolean

    IsMousePresent()

    Returns true if the current device produces mouse input.

    Declaration
    public bool IsMousePresent()
    Returns
    Type Description
    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
    Boolean

    MouseEmulateReset()

    Declaration
    protected void MouseEmulateReset()

    OnCreate()

    Declaration
    protected override void OnCreate()

    OnDestroy()

    Declaration
    protected override void OnDestroy()

    OnUpdate()

    Declaration
    protected override void OnUpdate()

    ProcessTouch(Int32, TouchState, Int32, Int32)

    Declaration
    protected void ProcessTouch(int id, TouchState state, int x, int y)
    Parameters
    Type Name Description
    Int32 id
    TouchState state
    Int32 x
    Int32 y

    SetMouseMode(PointerModeType)

    Sets mouse pointer mode to normal, hidden, or locked if mouse is available on the platform.

    Declaration
    public virtual void SetMouseMode(PointerModeType type)
    Parameters
    Type Name Description
    PointerModeType type

    SetSensorSamplingFrequency<T>(Int32)

    Declaration
    public void SetSensorSamplingFrequency<T>(int freq)
        where T : IComponentData
    Parameters
    Type Name Description
    Int32 freq
    Type Parameters
    Name Description
    T

    TouchCount()

    Returns the number of currently active touches.

    Declaration
    public int TouchCount()
    Returns
    Type Description
    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
    Unity.Mathematics.float2 screenCoord
    Returns
    Type Description
    Unity.Mathematics.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