I haven’t been able to find a clear explanation of an actor component’s lifecycle. Knowing which functions to override would really help understand where to do things correctly.
OnRegister seems to get called even when you modify an actor a little in the editor, like moving it, or changing a few properties. I noticed some negative side effects of doing things in OnRegister, like if I create other components in OnRegister, my actor might have all of those copies of components become part of its instance in the level.
There are other functions like Initialize. I noticed Movement components use this to find the component to control. This gets run if bWantsToInitialize is set.
Then there’s BeginPlay. I sometimes used to just move things to BeginPlay if I noticed it caused issues in OnRegister.
However if you don’t put things in OnRegister, it sometimes looks wrong when you place the actor or component in the world, until the game starts.
For example, if I have a property defining some collision radius in my actor, if I put code in BeginPlay to update a collision sphere’s radius, it’s hard to visualize in the editor what that collision’s radius is.
Then there’s also the ConstructionScript which seems to work similarly to OnRegister.
I’m just not 100% sure when to use what. Sometimes things like OnRegister and the construction script run when I don’t expect it and it breaks my objects in the level, but doing everything in BeginPlay makes it hard to see things correctly updated when I’m using the editor.