Can the PawnSensingComponent return a list of pawns?

I am using a PawnSensingComponent on my character to detect enemies in front of it for locking onto them. So far I can detect them but I want to get a list of all the detected enemies in line of sight. This is what I’ve been using for now.

if (PawnSensingComp)
	{
		PawnSensingComp->OnSeePawn.AddDynamic(this, &ACarnievilPrototypeCharacter::LockOn);
		PawnSensingComp->bOnlySensePlayers = false; // Makes non player pawns visible
	}

If I’m not wrong, OnSeePawn makes it so it can do something when a pawn is seen. Is there a way to get a list of all the visible pawns at a given moment?

If I understand correctly, you should be able to maintain an array of “seen” pawns by adding them whenever the OnSeePawn event is triggered. Then, in your tick function for the pawn that owns this component, clear that list out every frame…probably at the end of the tick function. Depending on when you need to access this array, you may need to find a more appropriate place to clear out the array every frame.