Announcement

Collapse
No announcement yet.

Accesing a Variable from UMG to Class Blueprint

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    It is a bit hard to understand, I had problems with it (and still have time to time). Let me try help you.

    When you need get the value of "something" that is in "other place" you need a refence to it. Sometimes it is easy (ie referencing to "self"), but others, like in your case, isn't that easy.

    So the steps to do are:

    1- Create the Widget
    2- Create a Reference to that widget
    3- Use that Reference in other places

    In this case, atleast as far I know, you need a general reference to it.

    I did it using a GAMEINSTANCE. A game instance is a blueprint that is "on" in every map and isn't reset when you change map.

    So you must create a variable in your GAMEINSTANCE blueprint type "your UMG".

    And after you create your widget, set that widget to that variable. So then you can call that variable to access that widget.

    Yup, it is a bit confusing. Thats why I stopped in my chair a day and did a resume in paint. I wait this can help you:

    Click image for larger version

Name:	ee682201ca1773964ee23241a8668bfa.png
Views:	2
Size:	134.3 KB
ID:	1084014

    Comment


      #3
      Thanks vegetamaker, that was a very useful information I was not aware of.

      Comment

      Working...
      X