InputActionMapBindingDrawer

Odin property drawer for InputActionMapBinding. Renders a polymorphic type selector for choosing a concrete binding implementation, and a foldable body showing callback validation status for each action in the associated action map.

Definition

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

[DrawerPriority(DrawerPriorityLevel.SuperPriority)]
[JetBrains.Annotations.UsedImplicitly]
public class InputActionMapBindingDrawer : OdinValueDrawer<InputActionMapBinding>

Inherits: OdinValueDrawer<InputActionMapBinding> (Sirenix.OdinInspector.Editor) Attribute: [DrawerPriority(DrawerPriorityLevel.SuperPriority)]

Remarks

This drawer provides two key features:

1. Polymorphic Type Selection

The header renders a PolymorphicObjectField that allows selecting any concrete InputActionMapBinding subclass. When the binding type changes, the drawer calls binding.Initialize(inputScheme, actionMapName) to configure the new binding, and refreshes the callback method cache.

2. Callback Validation Display

When expanded, the drawer shows every InputAction in the associated action map with a visual indicator:

  • Green check (✅) — A method with [InputActionCallback("ActionName")] exists on the binding class, shown alongside the method's nice name

  • Red X (❌) — No matching callback method found for this action

This provides immediate feedback during development, making it easy to spot missing callback implementations.

Callback Discovery

Callback methods are discovered using InputActionMapBinding.GetCallbackMethods(), which scans the binding type for methods marked with [InputActionCallback]. The results are cached in a dictionary keyed by (actionName, InputActionPhase).

Quick Lookup

Goal
How

Change binding type

Use the polymorphic object field dropdown in the header

See callback status

Expand the foldout to see green/red indicators per action

Null binding

Shows a prefix label without foldout (collapsed)

Fields

Field
Type
Description

inputScheme

InputActionScheme

The parent scheme, resolved from the Odin property tree

actionMap

InputActionMap

The resolved action map from the scheme

callbackMethods

Dictionary<(string, InputActionPhase), MethodInfo>

Cached callback methods keyed by (actionName, phase)

Methods

Initialize

Resolves the parent InputActionScheme from the property tree and discovers callback methods on the current binding type.

DrawPropertyLayout

Main draw method. Renders the header toolbar with foldout and polymorphic object field, then the callback validation body.

Parameter
Type
Description

label

GUIContent

Label from parent property (nicified via ObjectNames.NicifyVariableName)

Behavior:

  • If SmartValue is null: shows a prefix label and collapses the foldout

  • If SmartValue changes via the polymorphic field: calls Initialize() on the new binding and refreshes callbacks

  • If expanded and actionMap is resolved: calls DrawBindingCallbacks()

DrawBindingCallbacks (private)

Draws the callback validation list. For each InputAction in the action map, shows a colored label (green/red) with the action name and, if found, the callback method's name.

GetCallbackMethods (private)

Discovers all methods with [InputActionCallback] on the current binding type and builds a lookup dictionary.

Returns: Dictionary keyed by (ActionName, InputPhase) mapping to the MethodInfo, or null if no binding is assigned.

Common Pitfalls

circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated