Not seeing PlayerLocation in the BlackBoard

I’m having the same problem as PaulB7538. However, as shown in the screenshot, if I click the drop down to select a debug object, it’s showing no objects detected:

It does still show it in the Behavior Tree, I’m just kinda curious how to fix this, or what may be causing it.

Do you have an AI character in your level? Is it using your custom ai controller class? Does that have your behaviour tree assigned?

Yeah, I followed the videos pretty closely. I suppose I should also note that I’m using Unreal Engine 5.3 as well.

Would you mind showing all of that please?

Certainly.


And finally the code? Are you also sure it compiled successfully? Have you tried adding a log after running the behaviour tree?

Yeah, the code compiled successfully. It doesn’t effect the functionality at all, so I moved on to future videos. Here is what my CPP file looks like currently.

#include "Kismet/GameplayStatics.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "ShooterAIController.h"

void AShooterAIController::Tick(float DeltaSeconds)
{
	Super::Tick(DeltaSeconds);
	APawn* PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
	if (LineOfSightTo(PlayerPawn))
	{
		
		GetBlackboardComponent()->SetValueAsVector(TEXT("PlayerLocation"), PlayerPawn->GetActorLocation());
		GetBlackboardComponent()->SetValueAsVector(TEXT("LastKnownPlayerLocation"), PlayerPawn->GetActorLocation());
	}
	else
	{
		GetBlackboardComponent()->ClearValue(TEXT("PlayerLocation"));
	}
}

void AShooterAIController::BeginPlay()
{
	Super::BeginPlay();

	if (AIBehavior != nullptr)
	{
		RunBehaviorTree(AIBehavior);
		UE_LOG(LogTemp, Warning, TEXT("Running Behavior Tree"));
		APawn* PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);

		GetBlackboardComponent()->SetValueAsVector(TEXT("StartLocation"), GetPawn()->GetActorLocation());
	}
}

And I did check, it runs that log line, but I wasn’t sure what to put in it.

Does it work if you use try that from the behaviour tree window?

I’m not sure I understand what you mean.

Your initial screenshot is from looking via the blackboard asset, I’m saying do so from the behaviour tree (BT_EnemyAI, the next tab to the right of what is currently open in the screenshot)

Sure!

So is there still an issue?

Nope. I guess something between this video and where I am fixed it.
¯_(ツ)_/¯

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms