Sometimes it works fine, but sometimes it throws “__imp_FActorInstanceHandle::FetchActor(…) returned nullptr”. This is a bullet actor, so there are lots of instances in the scene, is this possible that they interfere each other somehow?
if (GetWorld()->LineTraceSingleByObjectType(HitOut, PreviousLocation, GetActorLocation(), ObjectsToDamage, QueryParams)) {
if (HitOut.GetActor()->CanBeDamaged()) { //VS shows that the error is here
UE_LOG(LogTemp, Warning, TEXT("Can be Damaged"));
}
else {
UE_LOG(LogTemp, Warning, TEXT("Can't be Damaged"));
}
GetWorld()->DestroyActor(this);
}