-
You don’t need ObjectInitializer anymore (definitely since 4.22, probably much earlier even). It’s a legacy struct, and it’s functionality was moved directly to UObject. That’s why you can call CreateDefaultSubobject in a UObject constructor even without referencing the ObjectInitializer. You will probably continue to see it in tutorials, etc. until everyone hears the good news (and even after, because old habits die hard).
-
Dig into the NewObject<T>() function. You’re supposed to use this to create new objects at runtime, and it has tons going on in the background. Somewhere in the depths of that function, you should find where ObjectInitializer is supplied to the constructor.
-
It’s your choice whether to move the Sprite component or the containing actor. I would suggest actor in most cases, but I guess it’s context dependent (like maybe you have many Sprites on one actor).
6 Likes