Download

UClass::StaticClass(); definition

I’ve been trying to find the definition of this function but I can’t even find it’s declaration in the file Class.h. I just want to give a look at the definition of this function for the sake of learning more about C++. If anyone could just post this function’s definition here in this thread, that’d be great.

Thanks!

To my knowledge, the StaticClass() function essentially retrieves reflection data of said type. It’s part of the reflection system built into Unreal. When a class contains UCLASS(), GENERATED_UCLASS_BODY(), etc, these annotations use the reflection system which Unreal Header Tool will handle at compile. Calling the StaticClass() function just returns the type of UObject instance using the instance->GetClass() function.

It’s defined within macros in ObjectBase.h, but I don’t think you’re going to learn a lot from looking at that. Also it’s about as far from standard C++ code as you’re going to get.

Thank you, guys! That was helpful!