Answers to some Behavior Trees related issues that often come up on the Unreal Source Discord.

Running tree from BeginPlay

Behavior trees should be triggered from the AI Controller’s On Possessed. Running the BT from Begin Play will cause issues.

Selector vs Sequence

  • Selector nodes execute child nodes until one of them succeeds
  • Sequence nodes execute child nodes until one of them fails
  • Decorators preventing child nodes from running counts as a failure.

Why does it look like a BT node is flashing

This means the node is either instantly succeeding or failing, and your behavior tree is resetting back to the beginning and immediately re-running the same task again, which then again instantly succeeds or fails. Rinse and repeat.

I want my BT task to wait until my character finishes doing something

The common answer here is to use an Event Dispatcher. For example, create a function in your character which triggers the action, and create an event dispatcher for it. Once the action finishes, call the dispatcher. Your BT task can listen to this event and call Finish Execute when appropriate.

Another option is to create a custom Latent Node which handles the event/delegate stuff, but this requires using C++ and is slightly more complex.

Spawned NPC doesn’t run BT logic

See BP spawned pawn doesn’t run AI logic

See also