I’d like to, as the title said, code a custom component which contain one or more child. It would create a hierarchy like when we drag’n drop components on one another in the Components tab of the Blueprint window. Right now, I’ve tried this:
UCLASS(meta = (BlueprintSpawnableComponent))
class UBadAssComponent : public USceneComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
UBadAssComponent(const FObjectInitializer& ObjectInitializer);
Right now, UE will mix all of the attributes from the two component when I add it in the editor. That behavior is really not helpful to make complex component. For exemple, one could think of a component that contain two or three different static mesh.
If needed, I could do a mock to demonstrate the idea.
Here some pictures to explain my point. Say I made a custom AActor in C++. When I create a blueprint from it, I can see each of its children on its own in the component tab.
You can then edit the property as you’d like by selecting every component in the actor. You can also add new components.
So now we have cool little hierarchy between all the different component. In UE term, I think we would say they are attached and so their transform vectors are relative to their parent (I think). Now I’d like to create a custom ActorComponent which, when added to a blueprint, would show as a parent-child hierarchy. The result would be like in the green box, but the hierarchy would have been made by c++ code instead of by drag’n droping in blueprint.
Please don’t mind the bad example used in the picture, I made it on the fly to demonstrate my idea. I also open to another way to achieve a similar result.