# Passing variable between blueprint and HUD.

**URL:** <https://forums.unrealengine.com/t/passing-variable-between-blueprint-and-hud/339692>\
**Category:** UI\
**Tags:** variables, hud, unreal-engine, question, Blueprint\
**Created:** [November 25, 2015, 8:36pm UTC](https://forums.unrealengine.com/t/passing-variable-between-blueprint-and-hud/339692 "2015-11-25T20:36:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oskar\_Engineer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Oskar\_Engineer](https://forums.unrealengine.com/u/Oskar_Engineer)\
**Post date:** [November 25, 2015, 8:36pm UTC](https://forums.unrealengine.com/t/passing-variable-between-blueprint-and-hud/339692/1 "2015-11-25T20:36:22Z")

</div>

So, I have a HUD in which is textbox “Height”. Whenever player will type something there I want to make it a variable and pass it to Mycharacter Blueprint.

Thats my HUD blueprint  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/e/a/8ead6dd6314c3e2e10c8c5d44a2ca9de6c12a391.png)

Now I want lets say write variable “Height” on the screen whenever i hit “Q”  
MyCharacter bp:  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/5/a75fc507e0c07dd620b2309885b4b8d6ea29e5c5.png)

I start game.  
Write something in textbox.  
Hit Q.  
And i see default value of variable. Just like “Set height” is not working.

Ty for help.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [November 25, 2015, 9:44pm UTC](https://forums.unrealengine.com/t/passing-variable-between-blueprint-and-hud/339692/2 "2015-11-25T21:44:35Z")

</div>

Hello Oskar\_Engineer,

Could you try hooking an Event Tick up to your print sting so that the variable is printed out every frame? This will allow you to see if the variable is being changed. I used the setup shown in the pictures provided with this one exception (using a Tick event on the print string ) and it appeared to work just fine. If this is not the case please feel free to reopen this issue with additional information.

I noticed that the only time the print string is being called in the original setup is when the widget is created. This means that the only variable that will be printed out is the default variable. A new widget is created every time ‘Q’ is pressed and the variable that is being printed is the “height” variable of that respective widget.

Make it a great day

---

<div class="post-metadata">

**Author:** ![Oskar\_Engineer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Oskar\_Engineer](https://forums.unrealengine.com/u/Oskar_Engineer)\
**Post date:** [November 25, 2015, 11:40pm UTC](https://forums.unrealengine.com/t/passing-variable-between-blueprint-and-hud/339692/3 "2015-11-25T23:40:14Z")

</div>

Unfortunatelly its still not working. It started to print default value.

I created variable in HUD bp and exported it to Characterbp. Now I will do it the other way.

Created variable in MyChar BP.  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/4/d34c343758595763098cdb51e379183f4edec19b.png)

Now Set it in HUD  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/5/7/957f66f8b33e96d39d351df7fd521322db6e88e6.png)

What am I supposed to connect to object? I tried “self” or my mesh but still get warning.

And thank u for interest in my problem.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [November 30, 2015, 3:56pm UTC](https://forums.unrealengine.com/t/passing-variable-between-blueprint-and-hud/339692/4 "2015-11-30T15:56:43Z")

</div>

Oskar\_Engineer,

Could you try connecting a character reference to the object pin of the cast? This should clear up the error that you are seeing.

---

<div class="post-metadata">

**Author:** ![DigiMish](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DigiMish](https://forums.unrealengine.com/u/DigiMish)\
**Post date:** [December 1, 2015, 1:22am UTC](https://forums.unrealengine.com/t/passing-variable-between-blueprint-and-hud/339692/5 "2015-12-01T01:22:58Z")

</div>

Hey, not sure if it helps - but I was trying to learn how to pass variables between blueprints, and I was looking at all this stuff - but it didn’t quite click. Then, I watched this simple example video, and I finally understood the whole Cast To thing:

[https://www.youtube.com/watch?v=E-PyDlvEQog](https://www.youtube.com/watch?v=E-PyDlvEQog)
