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:
Adds entries for any action maps in the asset that don't have a binding yet (initialized to
null)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
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.
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.
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.
actionMapName
string
Name of the action map
binding
InputActionMapBinding
The binding implementation to associate
RemoveBinding
Removes the binding for the given action map name.
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
schemeis null or has no asset: clears all bindingsAdds
nullentries for action maps that don't have bindingsRemoves 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
Null bindings are valid ValidateBindings() adds entries with null values for action maps that have no binding assigned. Callers iterating over the bindings must handle null values — this is why InputActionScheme.Enable() uses binding?.Bind(true) with a null-conditional.
Key is the action map name, not ID Bindings are keyed by the action map's name string. If an action map is renamed in the InputActionAsset, the old binding will be removed and a new null entry added on the next ValidateBindings() call.
Dictionary uses Odin serialization The bindings dictionary uses [OdinSerialize] because Unity's default serializer cannot serialize Dictionary<string, T>. Ensure Odin serialization is active on the containing object.
See Also
InputActionScheme — the scheme that owns and drives these bindings
InputActionMapBinding — abstract base class for binding implementations
InputActionSchemeBindingsDrawer — editor drawer for this class
InputSystem Overview — system overview
Last updated