What do UFUNCTIONs and UPROPERTYs actually do?

They’re not macros - they don’t get expanded by the compiler and you don’t really use them like macros. They’re not function calls - they are scanned by the header tool which does… something with them.

But what? The engine clearly interacts with them in some pretty fundamental ways. I know that the engine has a reflection system, but how that system works and what it does to that float I said should be visible in editor is a mystery.

Any insight would be appreciated.

They are macros, but you’re correct that the cpp compiler doesn’t expand them to anything. But before the compiler runs, that header tool, Unreal Header Tool, runs on the project headers to generate code (one is the XXX.generated.h file you’re forced to include). This generated code is what populates the reflection when the application starts up based on what all the UXXX macros are applied to.

2 Likes

Thank You for sharing this discussion