Accesing a Variable from UMG to Class Blueprint

  1. I have created a public integer Variable called UI_Int in UMG with default value of 0.
  2. On button click I am setting UI_Int value to 7
  3. How do I access the value of UI_Int in my class blueprint

Although I have gone through some similar questions in the forum about blueprint communication, I still not able to get it right.
Could you please help me out possible with images.I am new to this and am really interested to learn it.

You can grab the variable from a widget using casting. Drag the blue dot from the widget’s return value and type in your variable name.

Thank you so much AaronPaulina.You made my day!!:slight_smile:

Hi AaronPaulina,

After trying your said method I am only able to get default value of variable(UI_Int) which is 0.How do I get its value as 7 once the button is clicked.

This is what I want

  1. create a variable (UI_Int) in UMG and set its value to 0 (I am able to do this)
  2. On button click change it value to 7 (I am able to do this)
  3. Return UI_int value as 7 in my class blueprint (which is returning 0 currently instead of 7)

Am I missing something in your earlier comments?
Appreciate your help
Thank You

store the widget into a variable rather than simply dragging off the create node like shown above. After the variable is changed, grab the reference and pull off that to get the “UI Int” value. Pulling the value before you change it will give you default.

Thank you jitsmith. It worked