Docs / Input binder

Glossary: RegisteredActionHandle

The members of RegisteredActionHandle, in alphabetical order.

Color legend plain property method

One registered action, as the game sees it: its name and shape, its bindings, and the methods that change them.

A sealed class, in the namespace BorrowedTorch.InputBinding.Types.Handles. It has no public constructor: the register methods of InputBinder return one. Every call goes to the binder that issued it. Once its action is unregistered it goes inert: Bind returns ActionNotRegistered, Inputs is empty, and it never reaches a later action registered under the same name. The binding page shows it in context, with code.

Names are colored by what they are: a property or a method; values and fields keep the plain color.

Properties

Description →

string · Read-only. The action’s description, or null.

Inputs →

IReadOnlyList<BaseInput> · Read-only. The action’s slots in order, InputBindingsPerAction of them, each the input bound there or null. A live view: it shows later binds, and can’t be changed through a cast. Empty once the action is unregistered.

Name →

string · Read-only. The action’s name.

Representation →

object · Read-only. The action’s representation, or null.

Type →

InputType · Read-only. The action’s shape: only inputs of that shape can be bound to it.

Methods

Bind() →

Bind(int index, BaseInput input, bool forceMap = false) · Binds the input into the slot and returns a BindResult. On success the input that was in the slot is released, and an input moved from another slot of the action leaves it. Fails, changing nothing, when the input is null, the slot doesn’t exist, the shapes differ, the action was unregistered, or another action has the input and forceMap is false; see InputBinderResult. Doesn’t throw.

Parameter Type Description
index int The slot, from 0.
input BaseInput The input to bind. Its live data doesn’t matter; the object is kept, and read back by Inputs.
forceMap bool Takes the input from the action that has it, emptying that action’s slot. Default: false, which reports the conflict instead.

GetInput() →

GetInput(int index) · The input bound into the slot, or null: for an empty slot, a slot that doesn’t exist, or an unregistered action.

Parameter Type Description
index int The slot, from 0.

Unbind() →

Unbind(int index) · Empties the slot, and the input it held runs nothing from the next update. Returns false when the slot was already empty or doesn’t exist, or the action was unregistered.

Parameter Type Description
index int The slot, from 0.

WithDefaultBinding() →

WithDefaultBinding(int index, BaseInput input) · Binds the input into the slot as Bind does without forceMap, and returns this handle, so the defaults chain onto the registration. Throws ArgumentException when the input can’t be bound, naming the reason and, on a conflict, the action that has the input: two actions with the same default show at startup.

Parameter Type Description
index int The slot, from 0.
input BaseInput The input to bind.