As for the OnPerceptionUpdate…I didn’t know the owner of the delegates, so I don’t know how to access the delegate, but a partial syntax can be this:
OnPerceptionUpdated.AddUniqueDynamic(this, &AIController::CheckPlayer);
// Please make sure function parameter are same as your delegate.
void AIController::CheckPlayer(TArray<Acctor*> UpdatedActors)
{
const bool bFoundAPlayer = UpdatedActors.Contains(Enemy);
// I didn't know what is the one beyond branch node. You can continue here.
}
By the way, you don’t even have to use loop in your original blueprint. Use TArray Contains() function, it is also exposed in Blueprint. Unless your for-loop object has nested properties, then consider use FindByPredicate(), ContainsByPredicate() or FilterByPredicate() to throw in a lambda. (C++ only, unless you have Extended BP Library plugin)
(I have a feel of since this thing is a component, consider using CreateDefaultSubobject as part in the constructor. Spawning using NewObject would possibly fail. To access the blackboard, should be Blackboard->GetBlackboard(). Could be much simpler than I wrote above, which maybe wrong. Component created by DSO require you to setup value in BP, and you still can access it in C++.)