Disclaimer: Good chance we misunderstanding how things work
Given this class layout:
When we have an object of class MyBP_Pawn and in code, inspect the MyBP_Pawn.RootComponent member, it contains ONLY a DefaultSceneRoot for the BaseBP_Pawn Blueprint (I confirmed this by setting a unique tag on that componenet). That component has no children.
I would expect MyBP_Pawn.RootComponent to point to the entire hierarchy of components for the most derived class? (ie in the example above DefaultRootComponent would have a child in AttachChildren that contains a SkeletalMeshComponenet, …, etc )
- Calling MyBP_Pawn.GetComponents() does correctly give back a list of all the components, including SkeletalMeshComponenet in the example above.
- Originally we did not have a BaseBP_Pawn BP class, but added it to our hierarchy for the obvious reasons - aloiding duplication, etc. Previous to adding it, the RootComponent was the MeshComponenet itself. Everything worked fine
- We do not dynamically create components. They are added in the editor via the blue print, for example, MyBP_Pawn looks like this.
It’s likely we are doing something wrong, but if not - any suggestions? I would expect the RootComponent to point to the Root Component set in the BP, and its AttachChildren to contain the children components set in the BP! I suspect it has something to do with AttachTo() or RegisterComponent() not being called correctly.