As it stands, an ActorComponent cannot have sub-ActorComponents, but I feel like this would give a much needed sense of flexibility to the engine. In an earlier case, I was attempting to create a targeting system component that could be attached to any of my assets. It involved an ActorComponent that handled all of the logic. It was also going to involve a PrimitiveComponent underneath the ActorComponent that was an actual target. If I could do it the way I preferred, I would have been able to add the ‘TargetingSystem’ ActorComponent to my actor and automatically have the ‘Target’ PrimitiveComponent attached as well. I would also be able to directly reference the Target in my Blueprint for the TargetingSystem and position it relative to the parent’s transform however I wanted for initialization.
Instead, I have to attach a ‘TargetingSystem’ ActorComponent to the desired actor and then separately attach a PrimitiveComponent (such as a Cone or Sphere) to the same actor, manually assign the actual static mesh I want, and then finally go into the Actor’s Construction Script and assign the PrimitiveComponent as an object reference variable stored in the parent actor’s TargetingSystem component. It makes it a much more complicated process, and that is only for adding a single sub-component. If I wanted to build entire sub-systems that could all be attached with a single ActorComponent, it wouldn’t be practical.
If there is a ready-made alternative to this, then please elaborate on it so that we can determine whether or not this feature would actually be of merit to the engine. So far as I know, the most I would be able to do is create an Actor that is the Targeting System, put the Target on it (and any other pseudo-sub-components), and then simply add a reference to this actor in the actual actor’s variables, spawning an instance of the targeting system actor during the construction script. Again, shouldn’t necessarily have to do this dynamically.
Even with this arrangement, it is, to my understanding, still impossible to dynamically add entire groups of objects as components with a single call. If I could put them all under a component, then I could simply “Add Component” THAT component, but even if I want to Spawn Actor From Class using an actor that contains all of the desired components, I cannot then dynamically add a variable to reference this actor to the would-be entity actor.