Reflection system and sub-macro

Hey guys. Started messing up with abilities system and got an idea to define attributes with initter, getter, setter, delegate, etc. in one line. Like this:
Definition:



#define LAZY_ATTRIBUTE(ClassName, PropertyName, DispatcherSig) \
    UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Cool") \
    FGameplayAttributeData PropertyName; \
    \
    GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
    GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
    GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
    GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName) \
    \
    UPROPERTY(VisibleAnywhere, BlueprintAssignable) \
    DispatcherSig On##PropertyName##Changed;


Use:



LAZY_ATTRIBUTE(UMyAttributeSet, Health2, FPropertyChanged)


Though it works perfectly in C++, it doesn’t expose UPROPERTies to blueprints. I believe it is because of reflection system doesn’t “see” those sub-macros. Is it possible to fix somehow except moving UPROPERTY out of the macro? Thanks in advance.

Correct, UHT will not parse those macros inside macros. There is nothing you can do about it unfortunately.

The problem is Epic’s compiler cannot identify “PropertyName”. You have to manually define it, cannot be a macro dynamic.

So sad. But thanks for reply!