๐Ÿงฐ Object Variable Helper Macros

Short Description

Helper macros that generate getter/setter interfaces and dynamic property access for Object Variables.

Long Description

The Object Variable helper macros reduce boilerplate when implementing variable access interfaces and when bridging named dynamic properties. Use them in derived classes to keep Blueprint-facing getter/setter APIs consistent across variable types.

๐Ÿš€ Features

  • Generate interface function signatures for single, array, map, and multimap variants.
  • Provide boilerplate helpers for dynamic property get/set logic.
  • Standardize map and multimap value aliases.

๐Ÿ“š Usage Examples

class UMyBoolVariable : public UGorgeousObjectVariable
{
    GENERATED_BODY()
    UE_DEFINE_OBJECT_VARIABLE_SINGLE_INTERFACE_IMPLEMENTATION(bool, Value, Boolean)
};

UE_DEFINE_OBJECT_VARIABLE_MULTIPLE_REFERENCE_INTERFACE

Declares both getter and setter interface methods for multi-value containers (arrays, sets, queues, stacks, deques).

Parameter Name Type Description
VariableType type C++ value type (e.g. float).
VariableTypeName token Token used in the generated function name.
VariableNumberName token Token that represents the container name.
UE_DEFINE_OBJECT_VARIABLE_MULTIPLE_REFERENCE_INTERFACE(float, Float, Array);

UE_DEFINE_OBJECT_MULTIPLE_VARIABLE_GET

Returns a named dynamic property when an override name is supplied, otherwise returns the member variable.

Parameter Name Type Description
VariableType type C++ value type.
VariableName token Member variable to return when no override is provided.
return UE_DEFINE_OBJECT_MULTIPLE_VARIABLE_GET(float, Value);

Best Practices

  • Pair interface macros with the corresponding implementation macros in variable classes.
  • Keep macro usage close to the property it manages to reduce confusion.

Troubleshooting

  • If generated functions are missing, confirm the interface header is included before the macro use.
  • If dynamic property lookups fail, verify the property name matches a UPROPERTY.