# Whats the best way to communicate between the character, behaviour tree and the animation blueprint?

**URL:** <https://forums.unrealengine.com/t/whats-the-best-way-to-communicate-between-the-character-behaviour-tree-and-the-animation-blueprint/465521>\
**Category:** Character & Animation\
**Tags:** Behavior-Tree, unreal-engine, question\
**Created:** [May 20, 2020, 2:19pm UTC](https://forums.unrealengine.com/t/whats-the-best-way-to-communicate-between-the-character-behaviour-tree-and-the-animation-blueprint/465521 "2020-05-20T14:19:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![EdBennett](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EdBennett](https://forums.unrealengine.com/u/EdBennett)\
**Post date:** [May 20, 2020, 2:19pm UTC](https://forums.unrealengine.com/t/whats-the-best-way-to-communicate-between-the-character-behaviour-tree-and-the-animation-blueprint/465521/1 "2020-05-20T14:19:27Z")

</div>

Hi I’m studying setting up of character and I’m a little unsure what the best practices are for communicating between the character, behaviour tree and the animation blueprints.

For example say I wanted to get the character to attack the player. At the moment I am doing this:

- An event on the character to register when it see the player. I’m then setting a blackboard bool in the behaviour tree to say it’s seen the player.

 ![302379-seenplayer.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/d/a/ada82da26de8ca7ebb216ae06c96240a143795fd.png)

- I’m then using a decorator to trigger a task off the back of that tell the character to approach the player.
- Then when the character is close enough to the player, I’m setting a bool in the animation blueprint to tell it attack.

 ![302380-taskmakeattack.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/b/58b93b71413c921e86241be6b97c3d8f6745a0fa.png)

![302381-animationblueprint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/9/7c923290d989578e07ffb918b96c6ecb83896ca1.png)

- Then the animation blueprint is playing the animation and using a notifier on the animation combined with a sphere trace.
- That notifier would then tell the character that it’s been hit.

This might be the best way of doing it but it seems very convoluted.

So it effectively works as:

Character → Behaviour tree - \> Animation blueprint

---

<div class="post-metadata">

**Author:** ![JSwigart](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jswigart/32/469203_2.png) [@JSwigart](https://forums.unrealengine.com/u/JSwigart)\
**Post date:** [May 20, 2020, 2:55pm UTC](https://forums.unrealengine.com/t/whats-the-best-way-to-communicate-between-the-character-behaviour-tree-and-the-animation-blueprint/465521/2 "2020-05-20T14:55:08Z")

</div>

Generally you will have some blueprint or C++ code that sets a target actor on the blackboard, and then the actor can conditionally run logic based on whether the target actor is set. A boolean is far less useful building logic aroung. The mere fact that the target actor is valid(and not null) also fills the role of a boolean based targeting mechanism.

For attack animations, typically you would play an animation montage or sequence on the mesh of the character, both of which you can attach notify events to in order to fire events, to signal to the game useful events that happen within the scope of the attack animation playing. Maybe a certain frame plays a sound or effect, or performs a collision query to detect and apply damage, etc.

See

> **[Animation Notifications (Notifies)](https://docs.unrealengine.com/4.27/en-US/AnimatingObjects/SkeletalMeshAnimation/Sequences/Notifies/)**
>
> Notifies are a system for setting up and receiving events in Animation Sequences to perform external actions.

Here’s my recommended approach for the BT, built around an Actor reference value in the Blackboard called Target

 ![302382-simple-bt.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/6/8/368d62e89398e43cfd71eb62597b81561ccf27fe.png)

You can flesh out the tree above the HasTarget so there is a fallback behavior when they don’t have a target

You can do far more with an actor target reference than you can a boolean, and for attacking, you simply play an animation, and let any notify events trigger back any relevant data you need to be aware of.

---

<div class="post-metadata">

**Author:** ![EdBennett](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EdBennett](https://forums.unrealengine.com/u/EdBennett)\
**Post date:** [May 20, 2020, 3:36pm UTC](https://forums.unrealengine.com/t/whats-the-best-way-to-communicate-between-the-character-behaviour-tree-and-the-animation-blueprint/465521/3 "2020-05-20T15:36:24Z")

</div>

Great thanks. Just one question, When playing animations directly in the behaviour tree, it loses a lot of the functionality of the animation blueprint. For example it snaps into the animation, I’m also not sure I can do things like selected just parts of the body to animate.

---

<div class="post-metadata">

**Author:** ![JSwigart](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jswigart/32/469203_2.png) [@JSwigart](https://forums.unrealengine.com/u/JSwigart)\
**Post date:** [May 20, 2020, 3:48pm UTC](https://forums.unrealengine.com/t/whats-the-best-way-to-communicate-between-the-character-behaviour-tree-and-the-animation-blueprint/465521/4 "2020-05-20T15:48:58Z")

</div>

If you play a montage with the PlayAnimation task, the montage holds its own blend in values, and you can also configure the montage to play on different slots, which you set up prior to layer onto different parts of the body.

For example, in my animation blueprint, I have a state machine for basic locomotion pose, and then a full body montage override node, then an upper body montage override. Many of my attack animations just play on the upper body montage. slot.

From the perspective of the behavior tree though, it just plays the animations. The details for how it plays is wrapped in the montage asset.

---

<div class="post-metadata">

**Author:** ![TorQueMoD](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/torquemod/32/710746_2.png) [@TorQueMoD](https://forums.unrealengine.com/u/TorQueMoD)\
**Post date:** [June 14, 2026, 6:49pm UTC](https://forums.unrealengine.com/t/whats-the-best-way-to-communicate-between-the-character-behaviour-tree-and-the-animation-blueprint/465521/5 "2026-06-14T18:49:18Z")

</div>

I just want to say for Character to AnimBP, you use the following method:

Inside your character BP, get the Mesh \> Get Anim Instance \> Cast to Your\_Anim\_BP and then modify your Custom Variable as per normal.

 ![CommunicateWithAnimBP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/0/e/30eace572e2b3852e00a34f01747ee7a4daf9762.png)
