How am I able to control Order of Components (C++) in Blueprint’s Components Tab?
What is preferred the preferred way to attach UActorComponents, MyComponent->RegisterComponent() or AddOwnedComponent(MyComponent)?
Why is Unreal getting confused with UCombatComponents, e.g. why is in the BP 2nd Melee (3rd Melee) even though it is declared as Melee2nd = CreateDefaultSubobject<UCombatComponent>(TEXT("2nd Melee"));? Is this worth a bugreport? See screenshot:
If you are creating component in the CDO (objects constructor) then do not call RegisterComponent() it will throw an error. (only use it in the case of newObject outside of the constructor).
Perhaps registerComponent is messing with the order. it is not needed here (it’s called automatically)
The preferred way would be
x = CreateDefaultSubObject…
x->c->SetupAttachment(parent) e.g. GetRootComponent() if actor
there is no UActorComponents::SetupAttachment(parent). This only exists for USceneComponents.
I think AddOwnedComponent(MyActorComponent) is the way to go. In a previous version I only used this to attach all UActorComponents leading to the wrong order and naming.