I’m trying to understand how Actors and components work in better detail. Maybe it’d be great to put this on the docs:
There’s the constructor, and a BeginPlay event. I’m trying to understand what would be the best place to initialize different things.
As I understand, Components typically get initialized in the Constructor itself. This is also called by the engine to create a DefaultClass version of an object. It’s not good to put important gameplay related stuff here since it’ll crash the creation of a DefaultClass version.
I was also putting some things into the BeginPlay method, but i’m a bit confused how BeginPlay works. It looks like it doesn’t get called right away after an actor is spawned, which makes it difficult to initialize actors. If I’m spawning an actor, the things I need initialized aren’t initialized right away since its BeginPlay method hasn’t been called yet. I end up getting NULL pointer dereferencing.