InteractionInputTableDrawer
Custom Odin Inspector drawer for InteractionInputTable values. Renders the interaction input table as a foldable toolbar with a "Create Table" button for null instances and indented input entries showing each input's name and InputActionReference.
Definition
Namespace: Paragon.Townskeep.InteractionSystem.Editor
Assembly: Townskeep.Editor.dll
[DrawerPriority(0.0, 0.0, 3000.0), DrawerIndentation]
public class InteractionInputTableDrawer : OdinValueDrawer<InteractionInputTable>Inheritance: OdinValueDrawer<InteractionInputTable> → InteractionInputTableDrawer
Remarks
This drawer manages the visual representation of an InteractionInputTable — a reflection-based collection of InteractionInput entries discovered from [InteractionInput]-attributed methods on an Interaction.
The drawer handles three visual states:
Null table — Shows a "Create Table" button. When clicked, creates a new
InteractionInputTableinitialized with the parentInteractionreference (found viaFindParentOfType<Interaction>()).Empty table — Shows a collapsed toolbar with "(Interaction Has No Inputs)" label.
Populated table — Shows a foldable toolbar with each input entry rendered as a labeled
InputActionReferencefield, indented by 9px.
Nested AttributeProcessor
Contains a nested AttributeProcessor that disables the context menu on InteractionTable properties and the table child member when the property is on a prefab instance. This prevents accidental structural modifications to prefab-based interaction tables.
Quick Lookup
Access the input table
ValueEntry.SmartValue
Access individual inputs
Iterate tableProperty.Children
Find the parent Interaction
tableProperty.FindParentOfType<Interaction>()
Methods
DrawPropertyLayout (override)
Main draw method. Dispatches to null, toolbar, or input rendering based on state.
label
GUIContent
Property label, defaults to "Input Table" if null
DrawNullReference (private)
Renders the "Create Table" button. On click, creates a new InteractionInputTable with the parent Interaction as the owner.
DrawToolbar (private)
Renders the header toolbar. Shows a foldout when inputs exist, or a read-only "(Interaction Has No Inputs)" label when empty.
DrawInputs (private)
Iterates over the table's children and draws each input entry. For each child, extracts the InteractionInput from index [1] of the key-value pair and draws it with a label set to interactionInput.Name.
Properties (cached)
inputTable
InteractionInputTable
Cached reference to the drawn value
tableProperty
InspectorProperty
The "table" child property (the internal dictionary)
interactionProperty
InspectorProperty
The parent Interaction property, found via reflection
Visual Layout
Populated table:
Null table:
Empty table:
Nested Types
AttributeProcessor
Disables context menus on InteractionTable and its table child when the property belongs to a prefab instance. Prevents accidental structural edits to serialized interaction tables on prefabs.
ProcessSelfAttributes
Adds [DisableContextMenu] if HasPrefabs is true
ProcessChildMemberAttributes
Adds [DisableContextMenu] to the "table" member if on a prefab
Common Pitfalls
"Create Table" requires a parent Interaction — The drawer uses FindParentOfType<Interaction>() to locate the owning interaction. If the InteractionInputTable is serialized outside of an Interaction, the parent will be null and table creation will fail.
Prefab context menu is disabled — On prefab instances, the context menu for InteractionTable and its table entries is disabled to prevent accidental structural modifications.
See Also
InteractionInputTable — the type this drawer renders
InteractionInput — individual input entries rendered within the table
InteractionInputDrawer — drawer for individual
InteractionInputvaluesInteractionTriggerDrawer — related drawer for trigger rendering
Last updated