Hello. I’m working with AI and am using a Blackboard/Behavior Tree in UE4 to organize data, while my Services and Tasks are made in c++. I have that set up appropriately and is working the way I expect it too, but am running into one issue.
Currently, I am attempting to retrieve a list of all connected players in the “OnBecomeRelevant” function.
When running this bit of code, “GetFirstPlayerController()” returns NULL.
OnBecomeRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
GetWorld()->GetFirstPlayerController(); // Returns NULL
}
However GetWorld() is not null.
I can run this same code in my TickNode function without issue, but am trying to avoid doing so as I really only need to know this information once when this behavior tree is first ran.
Does OnBecomeRelevant not have access to this information? Or is there a different way of going about this?
Thank you for any help!