Why does Unreal call actor constructor before it is declared or spawned?

It was called to create ClassDefaultObject.
It’s a prototype pattern.

I don’t know the exact implementation but every time you spawn the actor, it need to copy the template/archetype/defaultobject.


Those property system that ChatGPT mention should already be in UClass which is in generated header.

It’s different than the actual actor class.

UClass own the ClassDefaultObject.

They also abstract away the blueprint node ( includes every function, new variable, the defualt value in blueprint ) unless you explicitly load.
The blueprint node is stored in UBlueprintGeneratedClass.

You can access default native C++ initialized value in ClassDefaultObject.
But for the blueprint, You need to iterate through UBlueprintGeneratedClass.

2 Likes