Action Variables

Editor tooling for the Action Variable system. Provides custom Odin Inspector drawers and popup menus for creating, displaying, referencing, and removing action variables directly within the Unity Inspector.

Architecture

spinner

Data Flow

spinner

Overview

Class
Role

Root drawer for the ActionVariables container — renders header, foldout, field/dynamic variable lists

Per-variable drawer — renders value field or reference display, link toggle, and delete button

Popup menu for creating new dynamic variables with a name and type

Popup menu for selecting a variable reference from parent Actions

How They Work Together

  1. ActionVariablesDrawer is the entry point. When an ActionVariables instance appears in the Inspector, this drawer renders a collapsible "Variables" section with a + button.

  2. Clicking + opens ActionVariableCreateMenu, which lets the user pick a type and enter a name to create a new dynamic variable via ActionVariables.AddVariable().

  3. Each variable (field or dynamic) is drawn by ActionVariableDrawer, which shows either the inline value editor or a reference label.

  4. The link toggle on each variable switches between direct-value mode and reference mode. In reference mode, a dropdown button opens ActionVariableReferenceMenu.

  5. ActionVariableReferenceMenu walks up the Inspector property tree to find parent Action nodes, collects all compatible variables, and lets the user bind a reference via ActionVariable.SetReference().

  6. The trash button on each variable calls ActionVariables.RemoveVariable() — but only for dynamic variables (field variables are not removable).

See Also

Last updated