Understanding generated code

Here’s what I understand and don’t understand:
.h:
I understand that Unreal generated a new class. I’m guessing the GENERATED_BODY() is a method, but it has now type… I’m also not so sure about why there are two public's and what a protected is although based on the generated comments: the first public sets the default properties at compile-time, the protected is called at run-time, and the second public is called every frame. Therefore, there will probably be methods that go into each of the subdivisions based on what they do. However, inside the subdivisions, I’m not sure what virtual and override do.

.cpp:
In the .cpp file, the BeginPlay() acts as a int main() function which runs once at the beginning, while the TickComponent() runs every frame. I’m not sure why both functions have to be restated inside each other, but I’m guessing the Super in front of each function is from some sort of imported library or from an Unreal generated class. Further, I don’t know what the UPositionReporter() does or the difference between it and the TickComponent(), but I think we’ll be able to turn it off.

Please correct me if I’m wrong, although I’m sure I’ll learn the meaning eventually!

Thanks,
Enrico

Privacy & Terms