Widget resetting

I have ran into an issue where my widget is losing its value on runtime. So I am currently working on some merchant NPCs for my project. I would like to display a simple widget above their head that states their name. I am using a data table that contain information for each NPC. I would like the name to change during the NPCs construction script so I could see the names in editor. I ran into some issues trying to achieve that but noticed this post. I got it working to display the correct name within the editor but they revert to the default value at runtime. I know I could correct this issue using begin play but don’t really want to repeat the logic twice. Is this new to 5.1 or I am going about it the wrong way?



I think the problem is in DelayUntilNextTick node, because you are firing you function on construction script, which is before anything starts to tick, when you start the game. Try moving the code to BeginPlay or get rid of DelayUntilNextTick node. Let me know, how it went :slight_smile:

Thank you for the suggestion, but the delay until next tick is needed in order to the names to update within editor. Without it the text never changes when selecting a different NPC. Guess I need to update the text within begin play as well.

I think it resets the widget on construction and begin play. (That’s the reason you need the delay, to update it after it was reset) So yes you will need to run that logic also on begin play. Just put it in a function which you can call from both. Setting some simple text variables will not impact performance. More important is that you have your widget set to manually update, or it will render the whole widget for every frame.

1 Like