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 ActionVariableReferenceMenu

Remarks

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.

spinner

Quick Lookup

Goal
How

Open the menu

referenceMenu.Show(buttonRect)

Clear a reference

Select "None" from the dropdown

Reference scope

All parent Actions' variables of compatible type

Constructor

Parameter
Type
Description

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.

Parameter
Type
Description

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:

  1. Always includes a "None" entry (maps to null) to allow clearing the reference.

  2. Starting from the current variable's parent Action property, walks upward through the Inspector tree using FindParentOfType<Action>().

  3. For each ancestor Action, finds its actionVariables child property and retrieves the ActionVariables instance.

  4. Filters variables using type.IsOfType(variable.Type) — only variables whose type is compatible with the current variable's type are included.

  5. Display names are nicified via ObjectNames.NicifyVariableName().

circle-info

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:

  1. Gets the first selected ActionVariable (or null for "None").

  2. Calls variable.SetReference(selectedVariable) to bind the reference.

  3. Marks the drawer's property serialization root dirty for undo/save.

Common Pitfalls

circle-exclamation
circle-exclamation

See Also

Last updated