Action Variables

The Action Variables subsystem provides a data-binding layer for the Action System. It exposes action fields and runtime-created values as named, type-safe variables that can be read, written, and cross-referenced between actions — enabling Inspector-driven parameterization and data flow without hard-coded coupling.

Architecture

Key Concepts

Concept
Description

Field Variable

A variable backed by reflection over an Action field marked with [Variable]. Reading/writing goes directly to the field. Discovered automatically.

Dynamic Variable

A variable created at runtime via AddVariable(). Stores its value in an internal object field.

Reference

An ActionVariable can be set to reference another ActionVariable. When IsReference is true, GetValue() delegates to the referenced variable, enabling data flow between actions.

[Variable] Attribute

Marker attribute (extends OdinSerializeAttribute) placed on action fields to opt them into the variable system.

Data Flow

Quick Start

Exposing a Field as a Variable

Reading / Writing Variables Externally

Adding a Dynamic Variable at Runtime

Cross-Referencing Variables Between Actions

Classes

Class
Description

Abstract wrapper that pairs a Variable with optional reference semantics. Generic subclass ActionVariable<T> adds typed Value property.

Container managing all field and dynamic variables for a single Action.

Internal abstract base for storage backends (FieldVariable, DynamicVariable).

See Also

  • Action — the base class whose fields this subsystem exposes

  • Action System — parent system overview

Last updated