Download

Using UFUNCTION() in a macro

Hi, I want to be able to set up multiple function generation using macros, but when I try to include the unreal macro in there as well it breaks down. Here’s what I’m doing:

What I want:



UFUNCTION() void TestFunction_exec(float time);
void __cdecl TestFunction(float time);


What I’ve been trying



#define EVENT_DECLARATION(functionName, ...)\
UFUNCTION() void functionName##_exec(##__VA_ARGS__);\
void __cdecl functionName(##__VA_ARGS__);\

EVENT_DECLARATION(TestFunction, float test)


However, the UHT doesn’t seem to be able to process this code correctly. It does compile, but the reflection provided by UFUNCTION doesn’t seem to work. The goal is just to clean up the definition of these functions that require function pairs.

I decided to go with an AutoHotkey script to procedurally create the needed data.

Hi, sorry I know this post is old but i’m interested by the subject, did you find a way to do it since?