Component with subobjects?

I’m trying to make some components which are child classes of USceneComponent. I was planning to have each one having various components themselves (three USceneComponent subobjects, for example), but I cannot figure out how to do that, nor whether that is even possible. Is a component supposed to be a single, self-contained thing?

Suppose I wanted an hierarchy like this:

**Root **(USceneComponent)
… First (USceneComponent)
… FirstChild (USceneComponent)
… Second (USceneComponent)

Is that possible with a component, or does it need to be an Actor?

It is possible with component. I can check details of the code when I’m back home but this is what I’ve used as starting point:

UCLASS() **  
 **class MYGAME_API MYGame_SomeActor : public AActor {     GENERATED_BODY() public:     MYGame_SomeActor(const FObjectInitializer& OI);**  
  **#c++ MYGame_SomeActor::MYGame_SomeActor(const FObjectInitializer& OI)     : Super(OI) {     RootMesh = OI.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("RootMesh")); }** 

The code is for actor but it works with components in the same way as far as I remember. After creating components you need to attach them to each other to form hierarchy that you want.

But I would advice against doing this. The problem you are going to have is that UI in the editor will be really messed up because of multiple default transforms (one per each scene component). It’s possible to hide them but then the only way you could access them is using property matrix and it’s not very user friendly.
I’ve got much better results from using ChildActorComponents, basically each of your “complex” components is made as an actor, which gives you full benefits of working with them as with actors. Being created by ChildActorComponent they can be easily accessed at any point of time. The downside is that they will be visible in level as actors, so when you do something like a LineTrace, take into account that actor can be a child of another actor via ChildActorComponent.