Ignored actors still are damaged by UGameStatics::ApplyRadialDamage().

Hi, I want to apply radial damage but not including AI characters, so I create a function in my Util class :

bool UArStatics::ApplyRadiusDamage(const UObject* WorldContextObject, float BaseDamage, const FVector& Origin, float DamageRadius, TSubclassOf<UDamageType> DamageTypeClass, TArray<AActor*>& IgnoreActors, AActor* DamageCauser, AController* InstigatedByController, bool bDoFullDamage, ECollisionChannel DamagePreventionChannel, bool bIgnoreAI /*= false*/)
{
	if (bIgnoreAI) {
		TArray<FOverlapResult> OverlapResults;
		WorldContextObject->GetWorld()->OverlapMultiByChannel(OverlapResults, Origin, FQuat::Identity, DamagePreventionChannel, FCollisionShape::MakeSphere(DamageRadius));
		for (FOverlapResult OverlapResult : OverlapResults) {
			AActor* OneActor = OverlapResult.GetActor();
			if (OneActor && OneActor->GetClass()->IsChildOf(AArAICharacter::StaticClass())) {
				IgnoreActors.AddUnique(OneActor);
			}
		}
	}

	return UGameplayStatics::ApplyRadialDamage(WorldContextObject, BaseDamage, Origin, DamageRadius, DamageTypeClass, IgnoreActors, DamageCauser, InstigatedByController, bDoFullDamage, DamagePreventionChannel);
}

But those actors still damaged by this radial damage function, if anyone knows why, please help me, thanks so much.

have same issue some days ago… did you check function call with debugger? are you sure bIgnoreAI is correct? did you check what IgnoreActors contains after for loop ?
when I was stuck at this point I use next approach:
/** includes */
#include “Kismet/KismetSystemLibrary.h”
#include “Engine/EngineTypes.h”

/** TODO add required object types to this array  */
TArray<TEnumAsByte<EObjectTypeQuery> > ObjectTypes;
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldDynamic));

TArray<AActor*> ActorsToIgnore;
ActorsToIgnore.Add(this);

TArray<AActor*> OutActors;

/* TODO remove to header sphere check radius */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Config", meta = (AllowPrivateAccess = "true"))
float Radius = 5000.f;

if (UKismetSystemLibrary::SphereOverlapActors(this, GetActorLocation(), Radius, ObjectTypes, YOUR_ACTOR_CLASS::StaticClass(), ActorsToIgnore, OutActors))
{
	/** TODO  */
}

Thanks for your reply.
Yes, I am sure about that bIgnoreAI equals to true, and what IgnoreActors contains after for loop exactly matches those AI characters in range of tracing sphere. here is the screen shot of what IgnoredActors contains(one greater spider and two small sipders around my player in debug time).

don’t understand what’s wrong in your code.
my spider explodes nice and don’t afflict my other spiders.

TArray<AActor*> ASpider::GetIgnoredActors()
{
	TArray<AActor*> Result;

	/** object types - pawns only  */
	TArray<TEnumAsByte<EObjectTypeQuery> > ObjectTypes;
	ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_Pawn));
	
	TArray<AActor*> ActorsToIgnore;
	UKismetSystemLibrary::SphereOverlapActors(this, GetActorLocation(), 
		RDP.OuterRadius, ObjectTypes, ASpider::StaticClass(), ActorsToIgnore, Result);

	return Result;
}

void ASpider::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
	if (Role == ROLE_Authority)
	{
		/** we are alive  */
		if (OtherActor && OtherActor != this && !StatsComp->bDead)
		{
			if (UStatsComp* OtherActorsStatsComp = Cast<UStatsComp>(OtherActor->GetComponentByClass(UStatsComp::StaticClass())))
			{
				if (StatsComp->Team != OtherActorsStatsComp->Team)
				{
					/** we are dead  */
					StatsComp->bDead = true;
					StatsComp->OnRep_Dead();

					/** don't afflict other teammate spiders  */
					TArray<AActor*> IgnoredActors = GetIgnoredActors();
					IgnoredActors.Add(this);

					UGameplayStatics::ApplyRadialDamageWithFalloff(this, RDP.BaseDamage, RDP.MinimumDamage, GetActorLocation(),
						RDP.InnerRadius, RDP.OuterRadius, RDP.DamageFalloff, DamageType,
						IgnoredActors, this, GetInstigatorController(), ECC_Visibility);
				}
			}
		}
	}
}

Hi, finally, I found out why IgnoreActors list didn’t work: every pawn in my game owns a weapon and weapon can take any damage as well, so when weapon takes any damage, damage will decrease and apply to my pawn again.
Thank you so much for your helpful answer, may you have a good day.

may or may not, thanks anyway. =)

Solved now!