Inside my level blueprint, I create the widget and hook it up to an EventBeginPlay.
Above the nodes for creating and setting visibility to the widget, are the nodes for my variable.
This variable is just the distance between the player and a TargetPoint. I set the z value of this distance to the “Set” for the variable Score.
Inside my widget blueprint is just text displaying the word “Score”, along with a text box upon which I would like my variable Score (the z distance) to be displayed in.
Inside the content binding which I named “Score” are the nodes for the content of the new binding “Score”. I cannot however get my variable Score (which is in the level blueprint) to enter the widget event graph, to set the Score (z distance) to the return value of the return node.
I have looked into each section of the documentation, but nothing will solve my problem. I just cannot find a way to set my variable to the text box of my widget.
I tried following along with the hud/health/ammo hud tutorial (mainly ammo b/c it displayed a value, not a progress bar . . . but I could not implement my variable like what was shown in the tutorial w/ the ammo variable (which had a target module AND a value module on the variable)
Ok. Let’s fix this. Just remove that binding on your textbox.
1.Add your widget different function “score change” , which will set textboxs text and which takes float on argument.
2. On begin play save reference of your widget like this and call “showWidget”
When controlling my player, I can click inside the text box and type in anything. Is this how my text box should be set up when trying to program it to a float? Or is it just my calculation of the variable or the way I used the SET node that is not appropriately setting my variable?
How can I create a reference of my widget and what will this do for the variable? I have a create widget like yours but my widget event graph is empty, so I do not know if referencing the widget will do anything with my current setup since I already have a createWidget connected to my EventBeginPlay.
It’s easy , level blueprint add variable , Type: Your_Widget and Name : “MyWidget” and after making widget, set value to it, like in picture. After this you dont need to make widget in event tick, just you will use reference on it. I will show you how to do this after you do first part.
I might have done what you intended…I right clicked the return value on the widget, promoted to variable, and attached it to the wiget and addToViewport.
There is not a spot for the distances nodes to connect to.
No not float. you need to create variable of your widget. Click on create score widget-> return value and make promote to variable like this. And it gives you reference of your widget.
Like so? Change score function is not a function but my “SET MyScore” variable (widget promoted variable)
I do not have an asset to select so I’m figuring this is the wrong node. I understand what the Set will do…it will update the value before setting to viewport. But how EventTick can edit the value for this set variable I am unsure of b/c when I drag the variable out and hit set, it asks for an asset which I do not have available