FSuggestProjectileVelocityParameters was introduced in 5.4 and has a FCollisionResponseParams member that's initialized as a mutable reference to FCollisionResponseParams::DefaultResponseParam.
struct FSuggestProjectileVelocityParameters
{
...
public:
FCollisionResponseParams& ResponseParam = FCollisionResponseParams::DefaultResponseParam;
}
This is a problem because game code that declares a FSuggestProjectileVelocityParameters can modify FSuggestProjectileVelocityParameters. This makes it very easy for game code to unintentionally modify the global static DefaultResponseParam. See repro steps.
Run the following code on BeginPlay:
void ACollisionResponseRepro::BeginPlay()
{
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("Default collision response to WorldStatic before: %d"), int32(FCollisionResponseParams::DefaultResponseParam.CollisionResponse.GetResponse(ECC_WorldStatic)));
const FVector StartLoc;
const FVector EndLoc;
UGameplayStatics::FSuggestProjectileVelocityParameters VelParams(GetWorld(), StartLoc, EndLoc, 1000.0f);
VelParams.ResponseParam.CollisionResponse.SetResponse(ECC_WorldStatic, ECollisionResponse::ECR_Ignore);
UE_LOG(LogTemp, Warning, TEXT("Default collision response to WorldStatic after: %d"), int32(FCollisionResponseParams::DefaultResponseParam.CollisionResponse.GetResponse(ECC_WorldStatic)));
}
Observe: the output of DefaultResponseParam.CollisionResponse.GetResponse() changes before and after the unrelated user code: 2 -> 0.
Expected: No change to DefaultResponseParam.CollisionResponse.GetResponse(): 2 -> 2.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-224510 in the post.
| 2 |
| Component | UE - Simulation - Core |
|---|---|
| Affects Versions | 5.4 |
| Target Fix | 5.8 |
| Created | Sep 17, 2024 |
|---|---|
| Resolved | Sep 17, 2024 |
| Updated | Oct 16, 2025 |