InputActionSchemeBindings

Serializable collection that maps action map names to InputActionMapBinding instances for a given InputActionScheme. Acts as the bridge between the scheme's InputActionAsset (which defines what action maps exist) and the concrete binding implementations (which define how those actions are handled).

Definition

Namespace: Paragon.Core.InputSystem Assembly: Paragon.dll

[Serializable]
public class InputActionSchemeBindings : IEnumerable<InputActionMapBinding>

Implements: IEnumerable<InputActionMapBinding>

Remarks

InputActionSchemeBindings is owned by InputActionScheme and serialized via Odin. It stores a Dictionary<string, InputActionMapBinding> keyed by action map name. When the scheme is enabled/disabled, it iterates over all bindings and calls Bind() / Unbind() on each.

Validation

ValidateBindings() synchronizes the internal dictionary with the scheme's InputActionAsset:

  1. Adds entries for any action maps in the asset that don't have a binding yet (initialized to null)

  2. Removes entries for any binding keys that no longer correspond to action maps in the asset

This is called during construction and on OnValidate() in the editor, ensuring the binding dictionary stays in sync with the asset.

Enumeration

The class implements IEnumerable<InputActionMapBinding>, yielding the dictionary values (bindings only, not keys). This allows InputActionScheme.Enable() to iterate directly with foreach.

Quick Lookup

Goal
How

Create for a scheme

new InputActionSchemeBindings(scheme)

Get a binding by map name

bindings.TryGetBinding("MapName", out binding)

Add a binding

bindings.AddBinding("MapName", binding)

Remove a binding

bindings.RemoveBinding("MapName")

Sync with asset

bindings.ValidateBindings()

Clear all bindings

bindings.Clear()

Iterate bindings

foreach (var binding in bindings)

Properties

Scheme

The InputActionScheme this bindings collection belongs to.

Constructor

InputActionSchemeBindings(InputActionScheme)

Creates the bindings collection for the given scheme and immediately validates against the asset's action maps.

Parameter
Type
Description

scheme

InputActionScheme

The scheme that owns these bindings

Side Effect: Calls ValidateBindings() during construction.

Methods

TryGetBinding

Attempts to retrieve a binding by action map name.

Parameter
Type
Description

actionMapName

string

Name of the action map

binding

out InputActionMapBinding

The found binding, or null

Returns: true if a binding exists for the given name.

AddBinding

Adds a new binding for the given action map name.

Parameter
Type
Description

actionMapName

string

Name of the action map

binding

InputActionMapBinding

The binding implementation to associate

RemoveBinding

Removes the binding for the given action map name.

Parameter
Type
Description

actionMapName

string

Name of the action map to remove

Clear

Removes all bindings.

ValidateBindings

Synchronizes the binding dictionary with the scheme's InputActionAsset. Adds missing entries and removes stale ones.

Behavior:

  • If scheme is null or has no asset: clears all bindings

  • Adds null entries for action maps that don't have bindings

  • Removes entries whose keys don't match any action map name in the asset

GetEnumerator

Returns an enumerator over the binding values (not keys).

Common Pitfalls

circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated