Why is my skeletal mesh component not showing up in owned components?

I have a custom actor class in C++ and a blueprint which uses this custom class as a parent.
In the blueprint I added a skeletal mesh component, and in my C++ class I set the root to a custom scene component. Thus my structure is

CustomRoot
    |
    -----> SkeletalMeshComponent

However, when debugging the C++ class, the Skeletal Mesh Component does not appear in the Owned Components of the Actor, is not a child of the root and can’t be found by GetComponents<USkeletalMeshComponent> or FindComponentByClass<USkeletalMeshComponent>() (since both methods iterate over the owned components).

Why is that and how can I get the Skeletal Mesh Component inside my C++ class (preferably without creating it as a member in the C++ class)?

1 Like

I did my search in the constructor of the actor, which obviously can’t work, since the constructor of the parent class is executed before the constructor of the blueprint. Thus the Skeletal mesh component did not yet exist at the time of search.

I now moved it to BeginPlay and it works.

1 Like