Download

How to get a variable from my UMG widget into my character BP.

This has got to be the easiest issue ever, but every tutorial I look at flies over my head and has a lot of extra features. I’ve read a lot about casting and event dispatchers, but not only do I not understand, it seems like these are meant for functions which I’m not worried about right now. I’ve got a boolean in my Widget called “CustomizeMode,” and I just need MyCharacter to check if it is true or false. The widget is created inside of MyCharacter, so I figured I would get easy access to its variables.

Boolean set inside my UMG widget:
e9b619f7c9808360381f1a8cd62e26fe9e377e2d.jpeg

MyCharacter trying to use the boolean:
066a1de4623a014112cff90011856bea739ee03b.jpeg

UMG tutorial

I have a tutorial on variable interaction between UMG and My Character BP here!

Rama’s UMG Wiki Tutorial

You just need to cast the return of your node where you create the widget, and then you can access your custom BP Vars on your widget!

I have many pics of this in the wiki tutorial!

Rama

Hi Rama. I had already seen your tutorial, but there was so much extra information and features that I couldn’t focus on how to solve my problem, so thanks for replying with a quick summary. I really thought I had already tried to do the casting thing and couldn’t get the “Cast to” action to appear, but what you said totally worked today. It makes me feel like an idiot, but I guess every Blueprint newb has to feel that way at some point. haha.

The problem I have now with your solution is that my cast only works if hooked up directly to the Create Widget action. I have that action promote my widget to a variable (See Above), but using that variable as the Casted object fails. I don’t want to be be forced to use my Created Widget action to hook up whenever I want to cast as my widget again. Thanks for your help! You saved my week!

Try this, create the same variable you are trying to pass to your Controller in the controller. Then on your widget binding, after your set variable nodes add a get controller node, grab the output of that node out in the box that pops up search for cast, pick cast to player controller. Then click the blue output from that node, and drag it out and search for set [what you named your variable in controller] that should allow you to set that variable in your player controller. You can do the same with casting to initiate events.

Hello,
if you create your widget in your hud like in this thread https://forums.unrealengine.com/showthread.php?35085-UMG-Tutorials-(-Introduction-and-data-binding-)
then you can call the widget variable from the hud, cast it and, from the cast, drag variables from your widget.

But i suggest wait for 4.5 and see full new doc to see if something will be easier to do.