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:

  1. Null table — Shows a "Create Table" button. When clicked, creates a new InteractionInputTable initialized with the parent Interaction reference (found via FindParentOfType<Interaction>()).

  2. Empty table — Shows a collapsed toolbar with "(Interaction Has No Inputs)" label.

  3. Populated table — Shows a foldable toolbar with each input entry rendered as a labeled InputActionReference field, 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

Goal
How

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.

Parameter
Type
Description

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)

Field
Type
Description

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.

Method
Behavior

ProcessSelfAttributes

Adds [DisableContextMenu] if HasPrefabs is true

ProcessChildMemberAttributes

Adds [DisableContextMenu] to the "table" member if on a prefab

Common Pitfalls

circle-exclamation
circle-exclamation

See Also

Last updated