I'm having issues updating the UI
I'm new to Unreal and am making a game to practice what I've learned and am stuck on an issue involving the UI. I have a float variable in a blueprint that keeps track of the score and I would like to have this score shown in the UI.
I casted to a blueprint I needed data from and then saved that variable. I then binded the textblock and created a function to get the score.
Does this all look correct and if so what steps can I take in order to update the UI?
asked Jun 19 '18 at 08:56 PM in Blueprint Scripting
Where is this widget created, a common issue is having the widget created before the class you are casting to in execution. Which will leave your reference variable blank because event construct happened before "claw1" exists in the game causing the cast to fail. Try plugging a print string into cast failed on the Cast To Claw1 node.
answered Jun 20 '18 at 05:07 PM
I don't like binding. If you're looking for a more efficient way to update your UI widget here's what I suggest.
After you create your widget (Ex: In your character), promote it to a variable like this: (I'll call it MyUI)
In your widget make the score text widget Variable so we can access it in our blueprint.
Next we'll create an event in our widget blueprint which we can call from our character to update the score whenever we need.
Finally in your character BP after you update the score you can call the event so the widget updates the score using the MyUI variable we made when we created the widget.
answered Jun 21 '18 at 12:26 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here