Actor's Collision Responses being overridden when actor is spawned

So I’m facing this issue, I have this actor blueprint set up with a capsule component using my desired configuration.
image

If I start the level with this actor already present in the level, everything works as expected, however if I spawn the actor at runtime and I check my spawned actor’s capsule component I can see this values had changed to this
image

This is the code I’m using to spawn the actor, nothing special

TSubclassOf<AEnemyARPGCharacter> SelectedEnemyClass; // Added from the blueprint

const AEnemyCharacter* EnemyCharacter = 
    GetWorld()->SpawnActor<AEnemyCharacter>(SelectedEnemyClass, 
    GetActorLocation(), GetActorRotation());

The workaround I’ve found is to manually set the collision channel back to the response I want after spawning, using this code

EnemyCharacter->GetCapsuleComponent()->SetCollisionResponseToChannel
     (ECollisionChannel::ECC_WorldDynamic, ECollisionResponse::ECR_Block);

However, I would expect it to preserve after spawning the values I had set in the Actor Blueprint. Am I mistaken?

Hopefully someone can shed some light on this. Thanks!

1 Like