docs.unity3d.com
    Show / Hide Table of Contents

    Struct KeyboardState

    Default state layout for keyboards.

    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 FourCC format { get; }
    Property Value
    Type Description
    FourCC
    Implements
    IInputStateTypeInfo.format

    Format

    Memory format tag for KeybboardState.

    Declaration
    public static 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
    In This Article
    • Constructors
      • KeyboardState(Key[])
    • Fields
      • keys
    • Properties
      • format
      • Format
    • Methods
      • Press(Key)
      • Release(Key)
      • Set(Key, Boolean)
    • See Also
    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