After expanding this macro, UFUNCION() disappeared. Is there a problem with what I wrote?

#define PROPERTY_GETTER(PropertyName)
UFUNCTION(BlueprintCallable)
auto Get##PropertyName#property() const {
return Property.PropertyName.Value;
}

I don’t see any backslashes there to escape the newlines, which should be causing you far more serious issues… but the code you posted is a empty macro followed by some code that should generate errors.

If the macro is multi-line, the end of each line that has another line following must have a \ at the end:

#define PROPERTY_GETTER(PropertyName)          \
	UFUNCTION(BlueprintCallable)               \
	auto Get##PropertyName##Property() const { \
		return Property.PropertyName.Value;    \
	}

(Edit: Fix copy paste error with second concat operator)

1 Like

And even if you’d written as @silnarm suggested, it wouldn’t work: the UHT don’t allow putting UFUNCTION(), UPROPERTY() and other UHT-specific macros inside of user macros: each of them have to be defined explicitely.

Though worth mention that such definition style is still valid for non-UFUNCTION() functions

2 Likes

the UHT

Yep, makes perfect sense considering what those macros are used for, I should have realised that.

Sorry, the '' is missing due to my editing.

Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.