ActionVariableReferenceMenu
Popup menu that lets the user select a variable reference from parent Action scopes. Walks up the Inspector property tree to discover compatible variables from ancestor Actions and presents them in a dropdown selector.
Definition
Namespace: Paragon.Core.ActionSystem.Editor
Assembly: Paragon.Editor.dll
public class ActionVariableReferenceMenuRemarks
This menu powers the reference-binding workflow for action variables. When an ActionVariable is in reference mode (link toggle enabled), the user can click the dropdown arrow to open this menu and select a variable from any parent Action in the Inspector hierarchy.
The menu uses Odin's GenericSelector<ActionVariable> and filters candidates by type compatibility — only variables whose type is assignable to the current variable's type are shown.
Reference Resolution Strategy
The menu walks upward through the property tree using FindParentOfType<Action>(), collecting variables from each ancestor Action's ActionVariables container. This enables nested Actions (e.g., within an ActionSequence) to reference variables defined in their parent Actions.
Quick Lookup
Open the menu
referenceMenu.Show(buttonRect)
Clear a reference
Select "None" from the dropdown
Reference scope
All parent Actions' variables of compatible type
Constructor
drawer
ActionVariableDrawer
The variable drawer that owns this menu
Stores the drawer and reads the ActionVariable from drawer.ValueEntry.SmartValue.
Methods
Show
Opens the popup menu anchored to the given rect.
buttonRect
Rect
The screen-space rect of the dropdown button
On each invocation, rebuilds the selector with fresh variable candidates (via GetReferencableVariables()), because the available variables may change as the Inspector state changes.
Reference Discovery
GetReferencableVariables
Builds the list of selectable variables:
Always includes a "None" entry (maps to
null) to allow clearing the reference.Starting from the current variable's parent
Actionproperty, walks upward through the Inspector tree usingFindParentOfType<Action>().For each ancestor Action, finds its
actionVariableschild property and retrieves theActionVariablesinstance.Filters variables using
type.IsOfType(variable.Type)— only variables whose type is compatible with the current variable's type are included.Display names are nicified via
ObjectNames.NicifyVariableName().
The menu skips the immediate parent Action of the current variable (starts one level up). Variables within the same Action are not shown as reference candidates — only variables from ancestor Actions.
Selection Handling
When the user confirms a selection:
Gets the first selected
ActionVariable(ornullfor "None").Calls
variable.SetReference(selectedVariable)to bind the reference.Marks the drawer's property serialization root dirty for undo/save.
Common Pitfalls
Empty dropdown If no parent Actions exist or no compatible variables are found, the dropdown will only show "None". This is expected for root-level Actions or variables with uncommon types.
Type filtering
Only variables whose type satisfies IsOfType() appear in the list. For example, a float variable will not see string variables from parent Actions.
See Also
ActionVariableDrawer — drawer that opens this menu
ActionVariable — runtime variable class with
SetReference()APIActionVariables — container queried for compatible variables
Last updated