Template mismatch during attachment. Attaching instanced component to template component

Hi Everyone, it’s been a while since I’ve been trying to solve this issue.

In my .h file:

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Room Components")
	USceneComponent *Scene_ProceduralComponents;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Room Components")
	UProceduralMeshComponent *ProceduralMesh_NorthDoor;

In my .cpp file constructor:

	ProceduralMesh_Floor = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("ProceduralMesh_Floor"));
	ProceduralMesh_Floor->SetupAttachment(Scene_ProceduralComponents);

	ProceduralMesh_NorthDoor = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("ProceduralMesh_North_Door"));
	ProceduralMesh_NorthDoor->SetupAttachment(Scene_ProceduralComponents);

The full Error:

Template Mismatch during attachment. Attaching instanced component to template component. Parent 'Scene_ProceduralComponents' (Owner 'Default__BP_ForestRoom_Spawn_C') Self 'ProceduralMesh_North_Door' (Owner 'BP_ForestRoom_Spawn_C_0').

I can clearly see that the problem is that the problem is that it’s trying to attach a component to the “Default__” class but I can’t really figure how to fix this.

This only happens the first time that I run the game with the debugger attached (Because it’s an Ensure and gets ignored after the first time), I see no problems in the generated dungeon but I think that I have to fix this.

I’ve read many threads about “Template mismatch during attachment” but none matched my case (I’ve also tried recreating the child blueprints from zero).

Thank you in advance!

1 Like

I wish this was the issue, I’ve already tried this so many times, but the warning is still there.
Thank you for your answer anyway!

Still an issue in UE5. I posted my workaround here: UE5 Template Mismatch During Attaching of Instanced Component - Development / Programming & Scripting - Epic Developer Community Forums (unrealengine.com)

1 Like

Hi, I had a similar issue in 5.4. Changing from BlueprintReadWrite to BlueprintReadOnly in UPROPERTY description of components created in the constructor fixed it. But before that I also refreshed the deriving BP by reparenting it to another class, reparenting it back and recompiling, so perhaps both actions were required, can’t say now.

1 Like

not working for me, i am using 5.4