`StaticMeshComponent not parented

Have created a class and then a blueprint from it.

ADoorSingleSlide has two static mesh components, doorpost and door and a Box Collision. The box is added at the blueprint. When dragging one blueprint to the UWorld() in the editor it is oriented where I drop it except for the door which is at zero³.

The door sticks at zero³ while dragging ADoorSingleSlide around. In the map editor the door mesh is at zero³ but in the blueprint it is also. No matter which location the blueprint has in the map.

The animation play as it should but at zero. After zeroing the static mesh door in the Map Editor, all seems fine.

When dragging this ADoorSingleSlide onto another blueprint in its corresponding editor, there (seems) is no way to zero it out. This ‘parent’-blueprint I’ll call BPParent.

When moving the ADoorSingleSlide (without zeroing the door) or the BPParent, the door sticks at zero³

Definition is at the declaration for simplicity here at the forum.



UCLASS()
class CITIZENOFTHEUNIVERSE_API ADoorSingleSlide : public ADoorBase
{
	GENERATED_BODY()
	
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default")
	UStaticMeshComponent* doorPost;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default")
	UStaticMeshComponent* door;

	ADoorSingleSlide::ADoorSingleSlide()
	{

		doorPost		= CreateDefaultSubobject<UStaticMeshComponent>(TEXT("doorPost"));
		doorPost->AttachTo(RootComponent); // changed this into RootComponent = doorPost; see next message
		
		door			= CreateDefaultSubobject<UStaticMeshComponent>(TEXT("door"));
		door->AttachTo( RootComponent );

	}

}


Blueprint (time is simple float from 0f, 0f to 0.5f, 1f):

Have tried the next thing too.



	doorPost = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("doorPost"));
	//doorPost->AttachTo(RootComponent);
	RootComponent = doorPost;


After compiling and a clean build nothing changed. However while moving on to some other part in the project, it apparently ‘worked’.

So simply said, it has been solved though I really like/need to know what happend since it didn’t work first and later on it did.

The base problem is/was that you didn’t have a RootComponent. You attach them to it but there is non.
I usually use a USceneComponent as root.
Also i recall using “SetupAttachment” instead of “AttachTo”.

The RootComponent is something by default, it has properties and events. The pop up states it is a (default) SceneComponent itself already. Just don’t completely understand yet although it seems to work.

You create a blueprint or c++ class, a root component is created but is unusable for attached components and therefore the blueprint is only usable as a placeholder withit uworld to a short extend?

By the way, SetupAttachment is MakeRoot (4.15.0).

Is it me or does UE has a steep starting point?