Selector never goes to second item yet I am able to stop at the return Succeed whilst debugging.
If I reverse their order, ChooseNewWaypoint is hit once, then only MoveTo is being selected.
Values are properly updated by the code. I had similar issue when ChooseNewWaypoint with BP equivalent yet it started to work after some rearranging.
Code of the ChooseNewWaypoint
EBTNodeResult::Type UChooseNewWaypoint::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
auto aiController = OwnerComp.GetAIOwner();
auto controlledPawn = aiController->GetPawn();
auto patrollingGuard = Cast<AAI_PatrolGuard>(controlledPawn);
auto patrolPoints = patrollingGuard->routePoints;
auto blackBoardComponent = OwnerComp.GetBlackboardComponent();
auto index = blackBoardComponent->GetValueAsInt(indexKey.SelectedKeyName);
if (patrolPoints.Num() == 0)
{
return EBTNodeResult::Failed;
}
blackBoardComponent->SetValueAsObject(waypointKey.SelectedKeyName, patrolPoints[index]);
auto nextIndex = (index + 1) % patrolPoints.Num();
blackBoardComponent->SetValueAsInt(indexKey.SelectedKeyName, nextIndex);
return EBTNodeResult::Succeeded;
}