docs.unity.cn
    Show / Hide Table of Contents

    Struct KeyboardState

    Default state layout for keyboards.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Namespace: UnityEngine.InputSystem.LowLevel
    Syntax
    public struct KeyboardState : IInputStateTypeInfo
    Remarks

    Can be used to update the state of Keyboard devices.

    // Send input event with A key pressed on keyboard.
    InputSystem.QueueStateEvent(Keyboard.current,
        new KeyboardState(Key.A));

    Constructors

    KeyboardState(Key[])

    Declaration
    public KeyboardState(params Key[] pressedKeys)
    Parameters
    Type Name Description
    Key[] pressedKeys

    Fields

    keys

    Declaration
    public byte *keys
    Field Value
    Type Description
    Byte*

    Properties

    format

    Declaration
    public readonly FourCC format { get; }
    Property Value
    Type Description
    FourCC
    Implements
    IInputStateTypeInfo.format

    Format

    Memory format tag for KeybboardState.

    Declaration
    public static readonly FourCC Format { get; }
    Property Value
    Type Description
    FourCC

    Returns "KEYS".

    See Also
    format

    Methods

    Press(Key)

    Declaration
    public void Press(Key key)
    Parameters
    Type Name Description
    Key key

    Release(Key)

    Declaration
    public void Release(Key key)
    Parameters
    Type Name Description
    Key key

    Set(Key, Boolean)

    Declaration
    public void Set(Key key, bool state)
    Parameters
    Type Name Description
    Key key
    Boolean state

    See Also

    Keyboard
    Back to top Copyright © 2023 Unity Technologies
    Generated by DocFX
    on 27 March 2023
    Terms of use