# How to Cast to Behavior Tree Task?

**URL:** <https://forums.unrealengine.com/t/how-to-cast-to-behavior-tree-task/2115976>\
**Category:** Blueprint\
**Tags:** parent, Behavior-Tree, casting, unreal-engine, cast, Blueprint, question\
**Created:** [November 11, 2024, 1:17pm UTC](https://forums.unrealengine.com/t/how-to-cast-to-behavior-tree-task/2115976 "2024-11-11T13:17:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maximum.Dino](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Maximum.Dino](https://forums.unrealengine.com/u/Maximum.Dino)\
**Post date:** [November 11, 2024, 1:17pm UTC](https://forums.unrealengine.com/t/how-to-cast-to-behavior-tree-task/2115976/1 "2024-11-11T13:17:10Z")

</div>

I have been trying for a very long time to cast to a task within a behavior tree from a UI widget. I am not sure what to use as my object reference for the task. The parent to the task is the BTTask Blueprint Base, but I don’t know what to use as an object reference for _that_. All I need is to be able to cast to the BTTask Blueprint Base successfully. Thank you!

[https://drive.google.com/drive/folders/1OxgeA\_lAh8xxRF\_zrPAs1JKBI\_IY94eQ?usp=drive\_link](https://drive.google.com/drive/folders/1OxgeA_lAh8xxRF_zrPAs1JKBI_IY94eQ?usp=drive_link)

---

<div class="post-metadata">

**Author:** ![baobao4435](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/baobao4435/32/950790_2.png) [@baobao4435](https://forums.unrealengine.com/u/baobao4435)\
**Post date:** [November 11, 2024, 3:34pm UTC](https://forums.unrealengine.com/t/how-to-cast-to-behavior-tree-task/2115976/2 "2024-11-11T15:34:13Z")

</div>

Hi,AFAIK,you can’t access/reference a task in behavior tree.

if you want the AI to change behavior you could access the AI itself and modify its variables/blackboard keys so that it affects the behavior tree branch making it to switch to another task.

Hope it makes sense to you.

---

<div class="post-metadata">

**Author:** ![Maximum.Dino](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Maximum.Dino](https://forums.unrealengine.com/u/Maximum.Dino)\
**Post date:** [November 12, 2024, 12:34am UTC](https://forums.unrealengine.com/t/how-to-cast-to-behavior-tree-task/2115976/3 "2024-11-12T00:34:51Z")

</div>

thank you for the reply! I’m sorry though, I’m not sure I understand what you mean by that. I would be so grateful if you could give an example of what you mean by that?

What I’m currently trying to do is linking a behavior tree task variable (which choses a character’s displayed emotion) to the UI character widget switcher. But I’m not sure how to connect the BTT variable to the widget switcher variable without casting…

---

<div class="post-metadata">

**Author:** ![baobao4435](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/baobao4435/32/950790_2.png) [@baobao4435](https://forums.unrealengine.com/u/baobao4435)\
**Post date:** [November 13, 2024, 4:40am UTC](https://forums.unrealengine.com/t/how-to-cast-to-behavior-tree-task/2115976/4 "2024-11-13T04:40:50Z")

</div>

why to think about tasks…not sure if you’re doing something different.

If you want some informations from the AI.you can get the AI and read its variables or blackboard keys.

This is how to get blackboard keys

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