ActionVariableCreateMenu
Popup menu that allows users to create new dynamic action variables from the Inspector. Presents a type selector and name input field, validates the input, and adds the variable to the owning ActionVariables container.
Definition
Namespace: Paragon.Core.ActionSystem.Editor
Assembly: Paragon.Editor.dll
public class ActionVariableCreateMenuRemarks
This menu is instantiated by ActionVariablesDrawer and opened when the user clicks the + button in the Variables header. It uses Odin's GenericSelector<Type> to present a list of supported variable types, then collects a variable name via a text field before committing the new variable.
The menu enforces two validation rules before enabling the "Add Variable" button:
Name validity — must match the pattern
^[a-zA-Z_][\w ]*(\.[a-zA-Z_][\w ]*)*$, must not be empty, and must not duplicate an existing variable name.Type validity — must be one of the supported types listed below.
Quick Lookup
Open the menu
createMenu.Show(buttonRect)
Supported types
int, float, string, bool, Vector2, Vector3, GameObject, Transform, Component, Action
Constructor
public ActionVariableCreateMenu(ActionVariablesDrawer drawer)drawer
ActionVariablesDrawer
The parent drawer whose ActionVariables will receive the new variable
Reads the ActionVariables instance from the drawer's ValueEntry.SmartValue and builds the type selector.
Methods
Show
Opens the popup menu anchored to the given button rect.
buttonRect
Rect
The screen-space rect of the button that triggered the menu
Creates an OdinEditorWindow popup containing the type selector and appends the name input field and "Add Variable" button via OnEndGUI.
Supported Variable Types
Integer
int
Float
float
String
string
Bool
bool
Vector2
Vector2
Vector3
Vector3
GameObject
GameObject
Transform
Transform
Component
Component
Action
System.Action
Validation Rules
Name Validation
Returns true when all of the following are satisfied:
Name is not null or whitespace
No existing variable in
ActionVariableshas the same name (HasVariablecheck)Name matches regex
^[a-zA-Z_][\w ]*(\.[a-zA-Z_][\w ]*)*$— must start with a letter or underscore, may contain word characters and spaces, supports dot-separated segments
Type Validation
Returns true when the type is non-null and is one of the supported variable types.
Visual Behavior
The "Add Variable" button changes color to indicate state:
No name or type selected
Gray (disabled)
Valid name and type
Green (enabled)
Invalid name or type conflict
Red (disabled)
Common Pitfalls
Duplicate variable names
The menu rejects names that already exist in the ActionVariables container. The button turns red to indicate the conflict.
Name pattern restrictions Variable names must start with a letter or underscore. Names beginning with digits or containing special characters (other than spaces and dots) are rejected.
See Also
ActionVariablesDrawer — parent drawer that owns this menu
ActionVariables — runtime container that receives
AddVariable()calls
Last updated