Struct InputDeviceCommand
Data header for a command send to an InputDevice.
Implements
Namespace: UnityEngine.InputSystem.LowLevel
Assembly: Unity.InputSystem.dll
Syntax
public struct InputDeviceCommand : IInputDeviceCommandInfo
Remarks
Commands are essentially synchronously processed events send directly to a specific device. Their primary use is to expose device-specific functions without having to extend the C# API used to communicate between input code and backend device implementations (which may sit in native code).
Like input events, device commands use FourCC codes to indicate their type.
Constructors
InputDeviceCommand(FourCC, int)
Declaration
public InputDeviceCommand(FourCC type, int sizeInBytes = 8)
Parameters
Type | Name | Description |
---|---|---|
FourCC | type | |
int | sizeInBytes |
Fields
BaseCommandSize
Declaration
public const int BaseCommandSize = 8
Field Value
Type | Description |
---|---|
int |
GenericFailure
Generic failure code for ExecuteCommand<TCommand>(ref TCommand) calls.
Declaration
public const long GenericFailure = -1
Field Value
Type | Description |
---|---|
long |
Remarks
Any negative return value for an ExecuteCommand<TCommand>(ref TCommand) call should be considered failure.
GenericSuccess
Declaration
public const long GenericSuccess = 1
Field Value
Type | Description |
---|---|
long |
sizeInBytes
Declaration
public int sizeInBytes
Field Value
Type | Description |
---|---|
int |
type
Declaration
public FourCC type
Field Value
Type | Description |
---|---|
FourCC |
Properties
payloadPtr
Declaration
public void* payloadPtr { get; }
Property Value
Type | Description |
---|---|
void* |
payloadSizeInBytes
Declaration
public int payloadSizeInBytes { get; }
Property Value
Type | Description |
---|---|
int |
typeStatic
The data format identifier of the device command as a FourCC code.
Declaration
public FourCC typeStatic { get; }
Property Value
Type | Description |
---|---|
FourCC |
Methods
AllocateNative(FourCC, int)
Declaration
public static NativeArray<byte> AllocateNative(FourCC type, int payloadSize)
Parameters
Type | Name | Description |
---|---|---|
FourCC | type | |
int | payloadSize |
Returns
Type | Description |
---|---|
NativeArray<byte> |