Setting Collision Object Type in C++ doesn't appear in Blueprints

Basically the tile says it all. I tried setting the mesh collision channel in the C++ constructor, but the collision change doesn’t show up in any child blueprint. I tried setting both the profile name and the object type but no luck.

BaseMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("BaseMesh"));
	BaseMesh->SetCollisionProfileName(TEXT("Build"));
	RootComponent = BaseMesh;

	ECollisionChannel NewCol;
	FCollisionResponseParams NewResp;
	// adds the build collision as a response
	if (UCollisionProfile::GetChannelAndResponseParams(FName(TEXT("Build")), NewCol, NewResp))
	{
		BaseMesh->SetCollisionObjectType(NewCol);
		BaseMesh->UpdateCollisionProfile();
	}


I don’t know if this has been fixed in newer versions of the engine, but I am using 4.27 because I needed specific plugins that didn’t work with the new engine versions. As always any help is appreciated!

Can you show the default settings for the “Build” collision profile?

It’s block all, so I don’t know if that is being set or if that is just the default for world dynamic. I did some extra testing recently and found out that this line fails UCollisionProfile::GetChannelAndResponseParams(FName(TEXT("Build")), NewCol, NewResp)
If I try to set the collision object type by the channel number from the enum (GameTraceChannel1 or whatever its called) it works. I would still prefer to get channels by names though.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.