How can i get variable from UMG Widget blueprint, in other blueprints ?

Guys i need your help, i create “Editable text box” and “button” on widget blueprint, after this i made an event “on button click”, to store text from editable text box. Now the question: how can i get this variable on other blueprints ? for example on “MyCharacter”

You need to assign the MyCharacter to a variable in the GUI so it has access to it just like normal blueprints. When you construct the widgets you can also assign them a player controller. Then you can access the player controller on the GUI cast it to your particular type, and then get information like the character pawn, or player health…etc.

Cheers,
Nick

If I understand you correctly, I made a couple of screenshots to show the result.
This is example of my event.
d8e5a87c54cf10cf9ccc59038cc4c1d89e8bff7d.jpeg
This is some errors in log after i try it in game.
8dd1563705b68e5f95bb564f11b7527bfc090006.jpeg

Help me with this, what did I do wrong? It looks very simple, but I’m trying to figure it out for several days, and there are no results.

Casting

I posted a complete tutorial that shows interaction between UMG widget blueprints and the My Character blueprint, it has lots of pics!

As you will see in my tutorial you need to cast your UMG widgets and then access the variables of each of your widget elements.

So there are a series of casts involved!

If you walk through my whole tutorial you will have the answer to your question when you are done!

Rama

Thank you, you helped me a lot!

Yay!

:slight_smile:

:slight_smile:

:slight_smile:

Rama

How about firing a custom event in a actor class blueprint… from UMG

That is in my tutorial as well!

Check out the section about binding the button Event!

https://wiki.unrealengine.com/UMG,_Create_Scrollable_List_of_Clickable_Buttons_From_Dynamic_Array#Create_Bind_Event

You can put any BP code you want there!

To get the actor so you can fire the event you have many options

  1. create a variable in the UMG BP, for your actor, and set the variable when the UMG widget is created, wherever it is created.

  2. use BP interface

  3. Get All Actors of Class, and find the one you want by name

I would tend to prefer option 1, assuming you create the UMG widget in your level BP or your My Character BP, you should be able to set the var on your UMG widget right there!

:slight_smile:

Rama

1 Like

Rama, one more question, when i create widget on level bp, i must casting it on my character bp ?

Can you show a picture of your question, or explain more?

UMG Tutorial Update

I updated my UMG tutorial to answer an important question!

So I now have a FAQ section :slight_smile:

Rama

I’m trying to understand this problem for about a week, and no results.
But it should be easy, I just need to understand the logic. I need to assign a variable from UMG, to the variable of MyCharacter. Help me man! :C
There some pics, with my problem.

This is button click event.
833420f52445618fa9809977f324be0f8ea147d7.jpeg

This is how i create widget and add to viewport.
54d22f5aa784085787769ff5b997abd3978ce98b.jpeg

And this is how i set the “name variable” of my character. I know about casting, but what should i cast and on what ?
0c59a5476f515607f7ab9ada4228c44d52f63fa3.jpeg

:frowning:

Bump. :slight_smile: still need your help guys.

I do actually show how to communicate between My Character BP and UMG in my tutorial

you need to save a casted version of your UMG widget in your Character BP to then get/set its vars

You should look closely at my pics in my tutorial!

Beyond that I do offer tutoring services:

Rama

I try to understand the same thing, but can’t use casts because I did not generate the Widget in the graph Editor,
instead I placed the widget into another Widget in the Designer which seems to work out. But now I have a button inside
one Widget and if that is being pressed, it should deactivate a Widget and activate another one instead.
I have Boolean vars to set if the Widget is active or inactive, but don’t know how to access those Variables from another
Widget. Can please someone explain it a bit so a newbie would understand it ? Until now in this thread there are only
fragments of information that seem to make no sense.

same here,

i have 3 blueprints
2 master items blueprints and my main Hud in UMG

I got buttons in my masters blueprints. Those masters are placed in my main HUD.

I want to affect other UMG Blueprint when i press button.
But i cant cast to other blueprint because i dont understand it :wink:

i need help too

i read the tut on the top of the post,

so i need to cast my widget action into a actor variable by set it ?