BTService returns null pawn depending on BT activation method

I have an AI controller, a pawn, and a behavior tree.

The behavior tree has a BTService_BlueprintBase which ticks once every five seconds.

I use the Event Receive Tick AI in the service to get the Controlled Pawn and then I check if it is Valid and print the result with a print string node.

If I active the behavior tree in the begin play of the AI Controller the service will continually return that the controlled pawn is not valid (further in the tree other tasks will be able to use the pawn).

If I activate the behavior tree using Event Possessed in the controlled pawn the service will continually return that the controlled pawn is not valid.

If I activate the behavior tree using Begin Play in the Pawn, use the get controller node, cast to my AI controller, and tell it to run the behavior tree then the service will return a valid pawn.

In all three cases the behavior tree is running but only in the pawn begin play does the controlled pawn seen by the behavior tree service ever return a valid pawn.

It seems as if the service will never check for the pawn again but store the very first result it gets. This doesn’t make sense thought because if the BT is actived using the event posses of the pawn it should exist at that time.

][1]

1 Like