When should I call RegisterComponent() and ReregisterComponent()? Should I ever?

I’ve seen several snippets/examples where, after attaching components, NewlyAttachedComponent->RegisterComponent() is called. In my experience, this has caused issues and has in some cases triggered breakpoints.

Can I get a definitive answer on whether I should be calling RegisterComponent() at all? The documentation for UActorComponent::RegisterComponent() doesn’t really give much information.

You use RegisterComponent() when you dynamically create a component at runtime. Typically, I would use it when adding component in the Construction script, for example. Otherwise, your component will not show up and/or problems could occur.

You can see an example here:

The problem in that post is unrelated but you can see the RegisterComponent() being used.

Great, thanks Michaël!

If it helped, you can mark it as “answered” for everyone else to enjoy! :slight_smile: Have a nice day!

Sorry, I marked it as answered before I commented, which reverted it back to unanswered. I’ll fix it now.