Add component to actor in C++ (the final word!)

Hey! So I spent the whole day trying to add this component…

the “MyActor->AddInstanceComponent(NewComp);” did not work for me, I’m using UE5.3. It was creating a diferent instance component in the same place of my existing component and ended up bugging out the whole character blueprint and having to create a new character.

The solution that worked for me was to add only the “CreateDefaultSubobject(TEXT(“YourComponentName”))” and then AddOwnedComponent( UActorComponent * Component ). Dont forget that you need to restart the whole project for changes to take effect. This is the tread that I followed: Create and Attach Custom Actor Component - #6 by ErayT