Passing variable between blueprint and HUD.

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

Now I want lets say write variable “Height” on the screen whenever i hit “Q”
MyCharacter bp:

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.

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

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.

Now Set it in HUD

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.

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.

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