Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

GetValue for BBKeyType returns nullptr

Hello. I've been working on this for the weekend with little to no success and think I may be missing something very simple. I have a custom BlackboardKeyType and a TArray of objects within that class to store information. I Use a struct to hold the uint8 keys to simplify getting and setting my Blackboard variables.

Here are a few snippets of code

 struct KeyIDs
     uint8 STATE;
     uint8 PLAYERS;
 KeyIDs Keys;


 Keys.STATE = BlackboardComp->GetKeyID("State");
 Keys.PLAYERS = BlackboardComp->GetKeyID("Players");
 //Starts the behavior tree

EnemyAgro.h (My custom BlackboardKeyType inheriting from UBlackboardKeyType_Object)

 class BASIC_API UEnemyAgro : public UBlackboardKeyType_Object
     UEnemyAgro() {}

BTServiceBase.cpp (My main service) The nullptr occurs here

 void UBTServiceBase::TickNode(UBehaviorTreeComponent & OwnerComp, uint8 * NodeMemory, float DeltaSeconds)
         UBlackboardComponent *BBComp = OwnerComp.GetBlackboardComponent();
         AIController = Cast<ABase_AI_Controller>(OwnerComp.GetAIOwner());
         if (AIController)
             //This returns a nullptr
             UEnemyAgro *enemyAgros = Cast<UEnemyAgro>(BBComp->GetValue<UBlackboardKeyType_Object>(AIController->Keys.PLAYERS));

I've tested with the State KeyID and that returns a value with no issues

Here is an image of my Blackboard alt text

Thank you in advance for any assistance.

Product Version: UE 4.21
more ▼

asked Feb 11 '19 at 08:42 AM in C++ Programming

avatar image

1 1 2

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question