HUD Widget not showing properly unless I put a breakpoint

Hello there, I currently found an sligthly interesting bug that unfortunally interferes a lot with gameplay.

I have a widget that is spawned on Event BeginPlay() of player character that works at the same time as a HUD for the player.
I’ve set on that widget an Event Construct(), that modifies size and position of SizeBox on Canvas Panel that is supposed to be as X: 60% and Y: 25% of screen size, so it will always have proper size on screen no matter the screen size.

And now here’s the issue.
When I launch the level on editor as New Editor Window or Standalone Game, the element that was supposed to be resized, just dissapears completely.

However, if I’ll put a debugging breakpoint at Event Construct() of that widget, this widget suddenly shows up normally and properly.

I have honestly no idea what causes this issue as it makes no sense for me why just putting debugging breakpoint changes the outcome.

Any ideas how to fix this properly?

Hey there @Vulpixon732! Since the breakpoint pauses the sim, does the UI remain after the simulation continues?

@SupportiveEntity Yup, after you continue when breakpoint pauses, you have the result as shown above, which is what is supposed to happen normally but doesn’t without a breakpoint.

I’m genuinely stumped. The breakpoint should only pause the simulation the frame that event is called, pass the info to the BPdebugger and that’s it… I’m going to see if I can look into the source code for the breakpoints and see if there’s any other interaction, but that’s actually kind of whacky. Could you try to run that from another event instead of on construct real quick?

Sure, let me just launch the engine and I’ll give an update.


Made Custom Event and called it from Event BeginPlay() on player character after the widget is spawned, no change.
Doesn’t show up without breakpoint, does with it.

Made Custom Event on GameMode to call it manually from console and it worked properly.
Though I noticed here also one thing:

Here you can see that widgets spawns “properly” with default values set on Designer calculated for screen 1920x1080, where resize function was not called yet.

Here above is screen AFTER launching the function for resize, might not be really visible with screenshot but the widget did got resized properly and adjusted to viewport.

In conclusion:
While called on BeginPlay(); from Player Character which spawns the widget and Construct(); from the target widget it does not work properly and completely dissapears for some reason without breakpoint.

While called manually or with a breakpoint on Construct(); or BeginPlay(); it works properly, so the function technically works properly.

Oh hmm, does the referenced stats size box change in position/size on construct/frame 0/1? I’m thinking this has to be dealing with the resize and reposition happening on construct but BeginPlay does it as well so this is odd. Let’s try one more test, reattach it to your construct, put a 0.0 delay node in front of it (basically a 1 frame delay), and see if it reacts.

0.0 Delay node does not work, but 0.01 (and no less) Delay suddenly works.

That confirms my hunch that it’s one of those initialization issues I run into on the forums frequently enough, but really didn’t expect it for resizing UI elements. These are the types of actions that should work during construct. So the final question is, will the delay work for your game in this instance? As there’s likely no workaround better for construct issues. The one frame usually works for it however. Maybe if it needs to be there quickly and the pop in is ugly, you could dress it up with a timeline for visibility and make it fade in.


Should be fine, we can always mask that “sudden pop” with a loading screen after all. (When I’ll make it and actually learn how to make and use it)

Thanks for help then!

No problem! I learned something from this myself! Breakpoints actually do have an effect on the simulation by at minimum 1+ frame disruption. This will help in the future when working with similar cases.