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 nameRed 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
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
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.
label
GUIContent
Label from parent property (nicified via ObjectNames.NicifyVariableName)
Behavior:
If
SmartValueis null: shows a prefix label and collapses the foldoutIf
SmartValuechanges via the polymorphic field: callsInitialize()on the new binding and refreshes callbacksIf expanded and
actionMapis resolved: callsDrawBindingCallbacks()
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
Only checks PERFORMED phase The callback validation display only checks for methods with InputActionPhase.PERFORMED. Methods bound to STARTED or CANCELLED phases are present in the dictionary but not visually validated in the list.
Binding initialization on type change When the user selects a new binding type via the polymorphic field, binding.Initialize(inputScheme, label.text) is called. The label.text is used as the action map name. If the label does not match the actual action map name (due to nicification), this could cause a lookup failure.
Action map is lazily resolved The actionMap field is resolved via inputScheme.GetActionMap() on first draw, not during Initialize(). If the scheme's asset is not yet assigned, the action map will be null and the callback body will not render.
See Also
InputActionMapBinding — runtime class this drawer renders
InputActionCallbackAttribute — attribute used for callback discovery
InputActionSchemeBindingsDrawer — parent drawer that contains these binding entries
Editor Overview — editor tooling overview
Last updated