When I run a cooked version of my project (DebugGame or packaged), I’ve noticed that my widgets don’t destroy themselves properly. When I go between levels, sometimes widget persists and is still present despite destroying it on EndPlay.
After adding a Print node in my BeginPlay event, I noticed that HUD blueprint would sometimes fire BeginPlay event twice. This must be causing widget to stop destroying correctly, most likely overwriting first widget created with another widget created on second event call.
I could probably just use a DoOnce node, but I don’t really feel like adding a DoOnce every time I want to make a new HUD. I saw a suggestion somewhere that UE4 sometimes duplicates blueprints when you rename/move them, and I found some duplicates; but they weren’t duplicates of blueprint in question and it didn’t solve issue.
I haven’t been able to reproduce this yet. Where are you creating widget? Can you reproduce this in a new project, or only your current project? If you can put together a small test project with which this occurs and upload it somewhere, I can take a look to see what might be causing this. Otherwise, a detailed step-by-step guide to reproducing it would be very helpful. Thanks!
I fixed my problem! What was happening was I was calling OpenLevel multiple times. way this happened was that I couldn’t call OpenLevel straight away, because I wanted to render a loading screen first. To do this, I had to defer call to OpenLevel until end of next ReceiveDrawHUD call.
My mistake was that I assumed that OpenLevel would only be called once, as I thought it would almost immediately destroy level and load up a new one.
In short: Adding a DoOnce node after IsTeleportTriggered branch at end of my ReceiveDrawHUD event before calling OpenLevel fixed it.