Struct BufferedInput
An immutable snapshot of a single buffered input event, capturing the action identifier, value, timestamp, and originating device at the moment the input occurred.
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public readonly struct BufferedInput
Remarks
InputBufferManager stores these entries in a ring buffer. Each entry ages in real time via the Age property and is considered expired once its age exceeds the configured buffer window (see DefaultBufferWindow or per-action overrides).
BufferedInput is a readonly struct. All copies share the same
data; there is no mutable state. Use Invalid as a sentinel for
"no input found" results from peek and consume operations.
The timestamp is recorded using Time.realtimeSinceStartupAsDouble, which
continues to advance while the game is paused and is unaffected by time scale.
This ensures that buffered inputs age correctly regardless of pause state or slow
motion effects.
Constructors
BufferedInput(string, float, double, InputDevice, InputDeviceType)
Initializes a new BufferedInput with full metadata.
Declaration
public BufferedInput(string actionID, float value, double timestamp, InputDevice device, InputDeviceType deviceType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actionID | The identifier of the action that was performed. Should be non-null and non-empty
for a valid entry; pass |
| float | value | The input value at the time of the action; typically |
| double | timestamp | The value of |
| InputDevice | device | The Unity Input System device that generated the action, or |
| InputDeviceType | deviceType | The InputDeviceType category of |
Properties
ActionID
Gets the identifier of the action that was buffered.
Declaration
public string ActionID { get; }
Property Value
| Type | Description |
|---|---|
| string | The same string that was passed to BufferAction(string, float)
when this entry was created. Never |
Age
Gets the elapsed real time in seconds since this input was recorded.
Declaration
public float Age { get; }
Property Value
| Type | Description |
|---|---|
| float | The difference between |
Device
Gets the Unity Input System device that generated this input, if known.
Declaration
public InputDevice Device { get; }
Property Value
| Type | Description |
|---|---|
| InputDevice | The originating UnityEngine.InputSystem.InputDevice, or |
DeviceType
Gets the InputDeviceType category of the device that generated this input.
Declaration
public InputDeviceType DeviceType { get; }
Property Value
| Type | Description |
|---|---|
| InputDeviceType | The device category inferred at buffer time, or Unknown if no device was provided or if the device could not be classified. |
Invalid
Returns a sentinel BufferedInput that represents the absence of a valid buffered input event.
Declaration
public static BufferedInput Invalid { get; }
Property Value
| Type | Description |
|---|---|
| BufferedInput | A BufferedInput with a |
IsValid
Gets whether this entry represents a real buffered input (as opposed to the Invalid sentinel).
Declaration
public bool IsValid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Timestamp
Gets the real-time timestamp at which this input was recorded.
Declaration
public double Timestamp { get; }
Property Value
| Type | Description |
|---|---|
| double | The value of |
Value
Gets the magnitude of the input at the moment it was buffered.
Declaration
public float Value { get; }
Property Value
| Type | Description |
|---|---|
| float |
|
Methods
IsExpired(float)
Returns whether this buffered input is older than the given time window and should therefore no longer be considered valid for consumption.
Declaration
public bool IsExpired(float windowSeconds)
Parameters
| Type | Name | Description |
|---|---|---|
| float | windowSeconds | The maximum acceptable age in seconds. Must be a positive value; passing zero causes any input to be considered expired. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsWithinWindow(float)
Returns whether this buffered input is still within the given time window and remains eligible for consumption.
Declaration
public bool IsWithinWindow(float windowSeconds)
Parameters
| Type | Name | Description |
|---|---|---|
| float | windowSeconds | The maximum acceptable age in seconds. Must be a positive value; passing zero means only inputs that occurred in the exact current frame (age 0) are valid. |
Returns
| Type | Description |
|---|---|
| bool |
|
ToString()
Returns a human-readable summary of this buffered input entry.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string in the format
|