Download

BehaviorTree not firing

I added Navmesh and everything to the editor, made sure my AI Character is using it’s controller too. I can tell my AI see’s my character cause it sends off a message that it does, but the behavior tree isn’t working. Here is my code and btree, what did I do wrong?






i’m not seeing any point where you tell it what tree, and to actually start running the behavior tree?

I followed this video and did everything the guy did Unreal Engine C++ Tutorial - Stealth Game AI - YouTube. But what do you mean? How do I tell it that?

Usually people put a “Run Behavior Tree” node in the Blueprint On Character Possess event in their AI Controller … like so

I’m sure there’s a way to do it from native too

You are also mixing up selector vs sequence.
You should be using a selector here, not the sequence node.

Sequence fires from left to right and will continue till something fails.
Selector fires from left to right and will continue till something succeeds.

Alright well I changed sequence to selector, played around with it some more, nothing happened. And then @eblade said he doesn’t see anywhere where I tell the behavior tree to run, if you look in the AIController cpp file, you see " BeTreeComponent->StartTree(*Pen->BehaviorTree);". So yes, it does start. And I tell it what tree in my child AI blueprint file which I don’t show but I have my behavior tree assigned to the AI.

It’s difficult to read code from screengrabs, but also, there isn’t a screengrab of the AIController.