When there are many simultaneous collisions, sometimes the Actor parameter returned by the OnComponentHit is NULL, is this something I should consider or is there something wrong?
What would be the cases for the Actor parameter to be NULL?
I’m using UE 5.3.2
Constructor:
MyStaticMesh->SetGenerateOverlapEvents(false);
MyStaticMesh->SetNotifyRigidBodyCollision(true);
MyStaticMesh->SetSimulatePhysics(true);
Begin Play:
GetMeshComponent()->OnComponentHit.AddUniqueDynamic(this, &MyClass::OnHit);
Function:
void MyClass::OnHit(UPrimitiveComponent* HitComp, AActor* Other, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
if (Other == nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("Other is NULL"));
return;
}
}
This happens randomly, I still haven’t been able to understand when it happens.
Thank you!