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.
If I understand you correctly, I made a couple of screenshots to show the result.
This is example of my event.
This is some errors in log after i try it in game.
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.
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!
Thank you, you helped me a lot!
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!
You can put any BP code you want there!
To get the actor so you can fire the event you have many options
create a variable in the UMG BP, for your actor, and set the variable when the UMG widget is created, wherever it is created.
use BP interface
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!
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
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.
This is how i create widget and add to viewport.
And this is how i set the “name variable” of my character. I know about casting, but what should i cast and on what ?
Bump. 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:
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.
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
i need help too