Float data from Level BP to Widget BP

Hey guys,
I’ve been struggling with this for a few days now. I’ve set up a simple timeline system to handle the day/night cycle of the game world. It has two tracks, one controlling the rotation of the sun, one for the time (0-24.)

I’ve tried copying and altering various examples to other people’s similar problems however none of them are working.

I’m trying to create a few widgets that will use the float value. One to display the time, one to display the time remaining until sunset/sunrise. I also need the value so I can script some warning pop ups for the HUD.

Does anyone know the easiest way to do this?

Here’s a picture of the blueprint.

Hello @BallistikBiskit,

I think I have a good solution for you. It is a little long, but it will get the job done.

First I will go over my level Blueprint setup.

I used my level Blueprint to create and store my widget as you can see in the picture below.

Next I created a simple variable called “TestVar” and set its value in the Tick method of my Level Blueprint. This variable was only created for testing my methods. In your case you might want to use your values for displaying the time.

In the Tick method of my LevelBlueprint, I am assigning a value to my TestVar and am calling a function on my widget called “UpdateTestVar.” We will create this method in our widget later. Below is a picture of my setup.

Secondly we will go into my widget setup.

First I create my widget using the editor and named my widget “TestWidget”. My “TestWidget” has two import functions which allow it update and display the value of the variable from my Level Blueprint. It also has a variable called “WidgetVar” that stores the value of the variable getting displayed.

The picture below is of the first function called “UpdateTestVar.” All it does is to set the value of the “WidgetVar” variable to a specific input. A picture of this is shown below.

51261-testwidget+3.png

The second function is used to update the text field of my widget. You have to create this function in a unique way. First go to the Designer tab of your widget and select the text field you are working with. Then look in the Details panel for a category called “Content”. Next you should see a field called “Text” with a drop down box next to it. Choose the “Create Binding” option in this drop down to create your function as seen in the picture below.

Now go to this newly created method and use it to insert the value of your widget variable into your text field as seen below.

51265-testwidget+5.png

So now you should have a widget that is receiving a value from your Level Blueprint and is drawing that value onto the screen.

I know this tutorial was a little long so feel free to ask any questions in the comments below.

I hope this answer helps,

Farshooter

Hello Farshooter,
First off, thanks for taking the time to reply and explain, I really appreciate it.
I’ve copied everything I can following your steps, however I’ve inevitably ran into a problem.

when trying to place the circled nodes, they aren’t coming up as an option in the list. I’ve tried unchecking the ‘context sensitive’ box, and still nothing. any idea why this is?

I’m having the same problem with referencing the ‘widget var’ node in the last step.

51282-bpexample_03.jpg

thanks again for your help!

Ballistik

Never mind! I’ve got it to work. So the two missing nodes weren’t necessary for it to function, here’s a picture of my set up.

Also the reason the ‘WidgetVar’ wasn’t showing up for me was because I had created it as a ‘local varible’ rathen than in the normal variables tab. after i fixed that and compiled, it worked!

51310-fixedit_02.jpg

Thanks again farshooter.