hey i been trying learn behavior tree from this
now i have 1 problem that idk why happen .
so we have on see function like this::
SensingComponent->OnSeePawn.AddDynamic(this, &AAIpatrol::OnplayerCaught);
void AAIpatrol::OnplayerCaught(APawn * Pawn)
{
AAIContoller* PawnController = Cast<AAIContoller>(GetController());
if (PawnController)
{
GEngine->AddOnScreenDebugMessage(-1, 3, FColor::White, TEXT("u been seen"));
PawnController->SetPlayerCaught(Pawn);
}
and function setplayercaught()
void AAIContoller::SetPlayerCaught(APawn * Pawn)
{
if (BlackboardComponent)
{
BlackboardComponent->SetValueAsObject("Target", Pawn);
}
}
now problem is when he see player and reach her(move to blackboardkey “target” ) behavior tree become inactive and dont restart to go back and do left task again which is simple task for see its go back like this
EBTNodeResult::Type UTask::ExecuteTask(UBehaviorTreeComponent & OwnerComp, uint8 * NodeMemory)
{
GEngine->AddOnScreenDebugMessage(-1, 3, FColor::White, TEXT("loop"));
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}