Lot of Warning in behavior Trees

Why I am getting this warning in behavior trees?

LogBehaviorTree:Warning: OnCeaseRelevant called on Blueprint service None with invalid owner. OwnerComponent: BTComponent, OwnerComponent Owner: BP_AIVehicleController_C_0. OwnerComponent has BeginDestroyed flag

Thanks,

Sounds like your BT is being run for AI that has been killed. To avoid it call StopLogic on your AI controller’s BrainComponent.

Cheers,

–mieszko

Just to add on to this, I find it good practice to destroy the controller before the pawn. simply because a pawn can exist for an extra frame without a controller if it’s really required but you can get errors if your controller tries to run logic on your pawn and it does not exist anymore.

Mieszko and Justin, thanks for replying.
Now this may be a stupid question but I am not able to find “Brain component” in AIController. Is it only on c++ side now? When I search for brain component in blueprint, only thing its giving me is “Cast to Brain component”.
Please let me know what I am doing wrong here.

Thanks,

26391-getbraincomponent.png

Maybe it’s not available in the version you’re using?

ohhh, is it in 4,7? I am currently using 4.6.1.

Thanks,

Yes, it’s available in 4.7.

Ok cool. I will then upgrade it to 4,7.

Thanks for help and all the awesome things you guys are doing for UE4.

Thanks,

Don’t mention it. Keep on using it! :smiley:

This error message happens during normal destruction of AIController with running BT (for example, when Stop is pressed in editor), so I think it is an engine bug.

Mieszko, I created a simple project that reproduces this bug. Just open it in editor and press Play/Stop. As you’ll see in comments in BTService.uasset, there are actually two bugs related to NotifyDeactivation:

  1. OnCeaseRelevant isn’t called unless BTService implements NotifyActivation. Why? Maybe I don’t care about activation, I only want deactivation callback.
  2. NotifyDeactivation isn’t called when Stop is pressed.

So, looks like BehaviorTreeComponent::Cleanup isn’t properly doing what it is supposed to do.

Answering to myself: I think it was fixed by

commit e0acca6e4614bbe4b88ab75da683698497c33987
Author: Lukasz Furman <Lukasz.Furman@epicgames.com>
Date:   Fri Dec 19 05:52:26 2014 -0500

    added OnTaskFinished event to behavior tree task nodes,
    always calling OnCeaseRelevant and OnTaskFinished on active nodes when tree finishes (restart / end play)
    
    [CL 2393632 by Lukasz Furman in Main branch]

Note that this commit wasn’t included in 4.7.