InputEventAction
A synthetic event for an InputMap action.
InputEventAction represents a logical action, not a physical key. Constructing or editing the object does not inject a press into the game. Submit it with Input.ParseInputEvent; with buffering, global state can update later when the queue is processed.
The complete example requires an already registered action and creates a fresh event object for every call. Send a matching release for each press. Multiple virtual buttons for one action need their combined state coordinated: EventIndex = -1 does not create an independent hold for each button.
using System;
using Reckfell;
public static class VirtualActionExample
{
// The action must already exist. Each call creates a fresh event object.
public static void Send(StringName action, bool pressed, float strength = 1f)
{
if (!InputMap.HasAction(action))
throw new ArgumentException("Register the action before sending input.", nameof(action));
if (!float.IsFinite(strength))
throw new ArgumentOutOfRangeException(nameof(strength));
using var inputEvent = new InputEventAction
{
Action = action,
Pressed = pressed,
Strength = pressed ? strength : 0f
};
Input.ParseInputEvent(inputEvent);
}
}The event does not move the OS pointer or simulate a physical key. Changing InputMap while held can change slot selection: finish the press before editing bindings.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
InputEventActionConstructor
public InputEventAction();Creates an event without submitting input: Action is empty, Pressed = false, Strength = 1 and EventIndex = -1. Editing its properties does not itself change global Input state.
Properties4
ActionProperty
public StringName Action { get; set; }Logical action name. Input processing requires the action to exist in InputMap. Assigning the name does not create the action, a key binding or a physical key press.
EventIndexProperty
public int EventIndex { get; set; }Source index within the action. With -1, processing uses the extra virtual slot after its bindings, not a unique event-instance ID. Events for the same action and device share that slot; releasing one does not retain another source's independent hold. Do not change InputMap bindings between a press/release pair or use arbitrary numbers as button IDs.
PressedProperty
public bool Pressed { get; set; }Virtual action state in this event: true for press, false for release. Assigning it does not submit the event. Release does not clear the stored Strength; matching a released action nevertheless reports strength 0.
StrengthProperty
public float Strength { get; set; }Stored event strength. Finite values are clamped to 0..1; the initial value is 1. The property is not automatically cleared when Pressed = false, but GetActionStrength reports 0 for release. Validate that your own inputs are finite.
Methods7
GetActionStringName
public StringName GetAction();Returns Action without submitting the event or changing Input.
StringNameLogical action name.
GetEventIndexint
public int GetEventIndex();Returns EventIndex without submitting the event or changing Input.
intSource index; -1 selects the shared virtual slot.
GetStrengthfloat
public float GetStrength();Returns Strength without submitting the event or changing Input.
floatStored strength in 0..1 for finite inputs, independent of Pressed.
SetActionvoid
public void SetAction(StringName action);Sets Action using the property rules; does not submit the event.
| Name | Type | Default |
|---|---|---|
action | StringName | — |
actionLogical action name.
SetEventIndexvoid
public void SetEventIndex(int index);Sets EventIndex using the property rules; does not submit the event.
| Name | Type | Default |
|---|---|---|
index | int | — |
indexSource index; -1 selects the shared virtual slot.
SetPressedvoid
public void SetPressed(bool pressed);Sets Pressed; neither submits the event nor changes the stored Strength.
| Name | Type | Default |
|---|---|---|
pressed | bool | — |
pressedtrue for press, false for release.
SetStrengthvoid
public void SetStrength(float strength);Sets Strength using the property rules; does not submit the event.
| Name | Type | Default |
|---|---|---|
strength | float | — |
strengthStored strength in 0..1 for finite inputs, independent of Pressed.