Input System  v0.1
ISX.LowLevel.InputEvent Struct Reference

A chunk of memory signaling a data transfer in the input system. More...

Inherits ISX.LowLevel.IInputEventTypeInfo.

Properties

uint sizeInBytes [get]
 Total size of the event in bytes. More...
 
int eventId [get]
 Unique serial ID of the event. More...
 

Detailed Description

A chunk of memory signaling a data transfer in the input system.

Property Documentation

◆ eventId

int ISX.LowLevel.InputEvent.eventId
get

Unique serial ID of the event.

Events are assigned running IDs when they are put on an event queue.

◆ sizeInBytes

uint ISX.LowLevel.InputEvent.sizeInBytes
get

Total size of the event in bytes.

Events are variable-size structs. This field denotes the total size of the event as stored in memory. This includes the full size of this struct and not just the "payload" of the event.

Store event in private buffer:

unsafe byte[] CopyEventData(InputEventPtr eventPtr)
{
var sizeInBytes = eventPtr.sizeInBytes;
var buffer = new byte[sizeInBytes];
fixed (byte* bufferPtr = buffer)
{
UnsafeUtility.MemCpy(new IntPtr(bufferPtr), eventPtr.data, sizeInBytes);
}
return buffer;
}