DEV Community

Sunder Iyer
Sunder Iyer

Posted on



Today's gag: I setup and threw my first grenade in Unity and the moment it landed, the editor crashed.

Snippet of Unity's crash dialog upon grenade projection
perfect timing - kaboom

Today's lesson: So I'm not really learning Unreal right now but an interesting discussion around function-naming (yes hot topic, I know) cropped up. This led me to dig into UMG a little and I noticed this UFUNCTION macro. Unreal is well documented:

A UFunction is a C++ function that is recognized by the Unreal Engine 4 (UE4) reflection system. Any UObject or Blueprint function library can declare a member function as a UFunction by placing the UFUNCTION macro on the line above the function declaration in the header file.

Simply put, this macro enables your C++ function to be called from Blueprint, Unreal's visual scripting system. But what does the macro actually do to make this possible?

I found the macro definition in ObjectMacros.h and it does nothing!

#define UFUNCTION(...)
Enter fullscreen mode Exit fullscreen mode

So yeah the macro is a tag, meant to be parsed by another tool to enable reflection; in C++, it just produces an empty statement.

Top comments (0)