UPrimitiveComponent::SetCollisionProfileName
#include "Components/PrimitiveComponent.h"
Access: public
Specifiers: virtual
Description
Applies a named collision preset to the component, setting its object type, enabled state, and all channel responses in one call.
Signature
virtual void SetCollisionProfileName(FName InCollisionProfileName, bool bUpdateOverlaps = true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InCollisionProfileName | FName | Name of the collision profile defined in Project Settings > Collision. | — |
| bUpdateOverlaps | bool | If true, immediately recomputes which actors are currently overlapping. Default true. | true |
Return Type
void Caveats & Gotchas
- • Profile names are case-sensitive and must match a profile defined in Project Settings > Engine > Collision. A typo produces no error but leaves the component on the 'Custom' profile with undefined responses.
- • Built-in profiles: 'NoCollision', 'BlockAll', 'BlockAllDynamic', 'OverlapAll', 'OverlapAllDynamic', 'Pawn', 'CharacterMesh', 'PhysicsActor', 'Trigger', 'InvisibleWall'.
- • bUpdateOverlaps=true triggers EndOverlap on any actors no longer overlapping and BeginOverlap on new ones. Set false in bulk-initialization to avoid costly overlap recalculation.
Example
Switch between gameplay and ragdoll profiles C++
// During gameplay
MeshComponent->SetCollisionProfileName(TEXT("CharacterMesh"));
// On death — switch to ragdoll physics profile
MeshComponent->SetCollisionProfileName(TEXT("Ragdoll"));
MeshComponent->SetSimulatePhysics(true); Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?