# Setting variable in Animation Blueprint

**URL:** <https://forums.unrealengine.com/t/setting-variable-in-animation-blueprint/15056>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [November 11, 2014, 2:33pm UTC](https://forums.unrealengine.com/t/setting-variable-in-animation-blueprint/15056 "2014-11-11T14:33:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_bfee94af](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bfee94af](https://forums.unrealengine.com/u/anonymous_user_bfee94af)\
**Post date:** [November 11, 2014, 2:33pm UTC](https://forums.unrealengine.com/t/setting-variable-in-animation-blueprint/15056/1 "2014-11-11T14:33:31Z")

</div>

So I am trying to set a bool in my animation blueprint, but I am stumped to how do I actually set it. In my C++ code I have a OnSprintStart() and OnSprintEnd() functions, but im wondering is how do I make the animation blueprint set my variable (isRunning) to true and false based on those functions, or whatever input the user is pressing? Here’s what it looks like.

://imgur/Y7c0Bcb

Thanks Everyone!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_923c79df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_923c79df](https://forums.unrealengine.com/u/anonymous_user_923c79df)\
**Post date:** [November 11, 2014, 2:34pm UTC](https://forums.unrealengine.com/t/setting-variable-in-animation-blueprint/15056/2 "2014-11-11T14:34:24Z")

</div>

Do that in your character bp and then cast it to the animbp 🙂 With the casted variable you can now set the one in the anim bp to true or false

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bfee94af](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bfee94af](https://forums.unrealengine.com/u/anonymous_user_bfee94af)\
**Post date:** [November 11, 2014, 5:13pm UTC](https://forums.unrealengine.com/t/setting-variable-in-animation-blueprint/15056/3 "2014-11-11T17:13:24Z")

</div>

Im a little confused on how to cast it to the Anim BP I tried looking for the cast function but nothing?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_923c79df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_923c79df](https://forums.unrealengine.com/u/anonymous_user_923c79df)\
**Post date:** [November 11, 2014, 5:18pm UTC](https://forums.unrealengine.com/t/setting-variable-in-animation-blueprint/15056/4 "2014-11-11T17:18:22Z")

</div>

Here is how it works:

green = character bp + character bp variable in the anim bp  
blue = new created variable in the anim bp

 ![9f82f3874a5d972c20305c11e646b4ee20b276ed.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/8/9f82f3874a5d972c20305c11e646b4ee20b276ed.jpeg)

You can get the cast from the try get pawn owner node 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bfee94af](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bfee94af](https://forums.unrealengine.com/u/anonymous_user_bfee94af)\
**Post date:** [November 11, 2014, 6:45pm UTC](https://forums.unrealengine.com/t/setting-variable-in-animation-blueprint/15056/5 "2014-11-11T18:45:29Z")

</div>

Im only getting Cast to Player Controller, is there something I have to add in my C++ code to get it casting for the Character?

Also I added you on skype 😃

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_923c79df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_923c79df](https://forums.unrealengine.com/u/anonymous_user_923c79df)\
**Post date:** [November 11, 2014, 7:59pm UTC](https://forums.unrealengine.com/t/setting-variable-in-animation-blueprint/15056/6 "2014-11-11T19:59:31Z")

</div>

You have to drag out the wire from “try get pawn owner” -\> after that search for it in the search bar 🙂
