Struct KeyboardState
Default state layout for keyboards.
Implements
Namespace: UnityEngine.InputSystem.LowLevel
Assembly: Unity.InputSystem.dll
Syntax
public struct KeyboardState : IInputStateTypeInfo
Remarks
Can be used to update the state of Keyboard devices.
Examples
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;
public class Example : MonoBehaviour
{
void Start()
{
// Send input event with A key pressed on keyboard.
InputSystem.QueueStateEvent(Keyboard.current,
new KeyboardState(Key.A));
}
}
Constructors
KeyboardState(bool, params Key[])
Create a new KeyboardState with the given keys pressed.
Declaration
public KeyboardState(bool IMESelected, params Key[] pressedKeys)
Parameters
Type | Name | Description |
---|---|---|
bool | IMESelected | true if IMESelected state is enable |
Key[] | pressedKeys | pressed keys |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
See Also
KeyboardState(params Key[])
Create a new KeyboardState with the given keys pressed.
Declaration
public KeyboardState(params Key[] pressedKeys)
Parameters
Type | Name | Description |
---|---|---|
Key[] | pressedKeys | pressed keys |
Remarks
IMESelected state will not be set.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
See Also
Fields
keys
Declaration
public byte* keys
Field Value
Type | Description |
---|---|
byte* |
See Also
Properties
Format
Memory format tag for KeyboardState. Returns "KEYS".
Declaration
public static FourCC Format { get; }
Property Value
Type | Description |
---|---|
FourCC |
See Also
format
Declaration
public FourCC format { get; }
Property Value
Type | Description |
---|---|
FourCC |
See Also
Methods
Press(Key)
Declaration
public void Press(Key key)
Parameters
Type | Name | Description |
---|---|---|
Key | key |
See Also
Release(Key)
Declaration
public void Release(Key key)
Parameters
Type | Name | Description |
---|---|---|
Key | key |
See Also
Set(Key, bool)
Declaration
public void Set(Key key, bool state)
Parameters
Type | Name | Description |
---|---|---|
Key | key | |
bool | state |