Could really use some help/advice here. This Behavior Tree stuff isn’t really documented yet so having some trouble setting these keys properly. Also stumped as to why my DebugMessage is printing “0” in Blue color.
Behavior Tree
Blackboard Key
in BTService_FindAndDetectPlayer.cpp
void UBTService_FindAndDetectPlayer::ReceiveTick(AActor * OwnerActor, float DeltaSeconds)
{
AActor * PtrToAnActor = NULL;
UBehaviorTreeComponent* MyComp = Super::CurrentCallOwner;
if (MyComp == NULL)
{
return;
}
for (TObjectIterator<AActor> Itr; Itr; ++Itr)
{
//any coditions on choosing which actor, such as name or other things;
if (Itr->GetName()=="PlayerDetTest")
{
//Assign your created Ptr to actual Actor in game world
PtrToAnActor = *Itr;
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, "AM I WORKING?"); //WHY THE F IS THIS PRINTING "0"??
MyComp->GetBlackboardComponent()->SetValueAsObject(PointKey.SelectedKeyID, PtrToAnActor); //PointKey is set in the BehaviorTree to Player...I have TargetPoint named "PlayerDetTest" in level.
return;
}
}
//no actor found, return
if (!PtrToAnActor) return;
}
in .h
UCLASS()
class UBTService_FindAndDetectPlayer : public UBTService_BlueprintBase
{
GENERATED_UCLASS_BODY()
virtual void ReceiveTick(AActor * OwnerActor, float DeltaSeconds) OVERRIDE;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Blackboard)
FBlackboardKeySelector PointKey;
};