I have an actor on scene with a widget component. Its designed to display dynamically changing text in world space. However I cannot get it’s text component to change. I have a normal UI setup in screen space also with a similar component and its able to update. I don’t know what I’m missing with 3D widgets.
I’m using this same exact format for my normal hud too and its working, but not for 3D widgets.
It was throwing saying it was accessing nothing so I set my 3D widget to a variable like I did the normal widget. Under class in create widget, I’m setting variables the same way I did for Hud: I picked the widget blueprint from my content browser.
First you’ll want to create a binding for the widget text. I called mine “SetText” as you can see.
Create a text variable in another blueprint. I used my gamemode in this instance.
Then you’ll want to go back to the binding function you created at the beginning (SetText) and feed the WorldText variable into the output. Now, whenever the WorldText variable is updated, the widget binding ensures that the widget text updates automatically as well
Here you can see that the example function I created, randomly chooses to set the text to either “red”, “green” or “blue”. the widget updates live as you would expect.
What is"Main Game" variable and how was it set?
What calls this “SetText” binding?
I’m stuck on how bindings work.
When I create a binding, I get
To the left, I tried making a function named
SetText like in your exmaple.
But it doesn’t show up in the bindings list, so how do I select it?
You are creating a binding the correct way. You can rename the binding by right clicking “Get_WorldText_Text_0” and going to rename.
As for what calls the binding; it is called automatically by the engine whenever the variable going into the output node of the binding function changes.
The “MainGame” variable was created and set in the widget blueprint as shown below.
It is a reference to the custom gamemode blueprint I created.
How are you getting your Main Game to show in that menu? I have an actor in scene with my text variable but I can’t find a way to link it to a variable in the widget.
Sorry about not getting back to you on this one. I’m not sure how to explain further in text. If you’d find it helpful I could record a video showing the step by step process?
I figured it out. I easily get lost when I can’t manually trace how things are being executed. The binding thing worked and I made functions that fetch the variables the UI should display. I just didn’t understand how the return value of the bind was being applied to the UI element. Some how my hud widget was updating properly without the bindings and I tried to force the same format.