VariableAttribute

Marks a field as an action variable for runtime binding.

Definition

Namespace: Paragon.Core.ActionSystem Assembly: Paragon.dll

[AttributeUsage(AttributeTargets.Field)]
public class VariableAttribute : OdinSerializeAttribute

Inheritance: AttributeOdinSerializeAttributeVariableAttribute

Remarks

Fields marked with [Variable] are automatically discovered by ActionVariables and can be:

  • Modified at runtime via SetVariable<T>()

  • Bound to other variables via the Inspector

  • Serialized with Odin

Usage

public class MyAction : Action
{
    [Variable]
    private float duration = 1.0f;
    
    [Variable]
    private Transform target;
    
    [Variable]
    private AnimationCurve curve;
    
    protected override async Task OnExecute()
    {
        // Use variables...
        await Yield.WaitForSeconds(duration);
    }
}
circle-info

The [Variable] attribute can be applied to any serializable field type.

See Also

Last updated

Was this helpful?