Hey!
I’m trying to use the UseBlackboard function of the AAIController, but I can’t quite figure out the second parameters.
Here’s the signature:
/**
* Makes AI use the specified Blackboard asset & creates a Blackboard Component if one does not already exist.
* @param BlackboardAsset The Blackboard asset to use.
* @param BlackboardComponent The Blackboard component that was used or created to work with the passed-in Blackboard Asset.
* @return true if we successfully linked the blackboard asset to the blackboard component.
*/
UFUNCTION(BlueprintCallable, Category = "AI")
bool UseBlackboard(UBlackboardData* BlackboardAsset, UBlackboardComponent*& BlackboardComponent);
I’ve made a class that inherit UBlackboardComponent , created an instance with CreateDefaultSubobject method which return a UBlackboardComponent pointer. But I can’t find any way for the UseBlackboard method to accept it.
Anything I’m missing?
(I’m not at home, but I’ll add some code later to make sure it’s clear)
UPDATE:
It wasn’t that simple, but I made it work. In fact, you have to pass à pointer to an UBlackboardComponent, but the trick is that classes that inherit from UBlackboardComponent doesn’t seem to work. From my point of view, it seems weird, but maybe someone has an explanation? Cause my idea in the beginning was to design a class that inherit from UBlackboardComponent and have it configure his data set. So I would have a class that contain both and that is easy to work with. Instead, I had to move everything in my AIController. It seems like bad practice since the AIController has too much responsibility right now. Any idea?