Widgets are displaying for no reason?

I have widgets that have not been created or added to the viewport that appear when my player controller has unpossessed a pawn and is awaiting a new pawn from the server for a split second. This only occurs reliably in transition levels where there are no pawns being spawned and intermittently between respawns even though functions are called to remove all widgets. Even if the functions don’t execute, that doesn’t explain 15 widgets appearing for no reason when only one is in use at the time and I never added them to the viewport in the first place.

My first thought was to make sure that any visibility binding functions are not becoming visible due to variables becoming false, out or of scope during server travel, or respawns since some references would become invalid at this point, but that is not the case as they are defaulted to “hidden” anyway and most of them aren’t even in use. I have made them, but they sit in the project folder unused.

What is basically happening is that when the player controller is not in possession of a pawn for a brief moment, EVERY widget in the project folder not even in use in any functions whatsoever are displayed on screen all at once. The functions I use to remove my HUD widget work, but I see widgets that aren’t even being used.

I can combat this by making a loading screen at the correct time to hide this hideous event, but I’d like to get to the root of this if anyone has perhaps run into this or is this a bug?? Anything at all may help. I can work around this, but something isn’t right here. I have tried calling garbage collect in various places to no avail.

Hey there @Humanasset! This is definitely a wild one! I’ve never heard of phantom widgets deciding to appear.

Is it occurring only during ServerTravel? Does it occur during a singleplayer load level as well?

Are the widgets that are appearing just widgets in your assets but not used anywhere else? Or are they called and applied somewhere else, but not meant to be fired on Beginplay/construct?

Are you using Seamless travel? If so, what’s the gamemode on the transition level? Does that have your hud assigned in it?

I’m intrigued and confused!

Hey, thanks for the reply! This is specifically a multiplayer game… I have a hud widget that is called from the game instance from the level blueprint on begin play when travelling into the game level for gameplay. It does have visibility bindings for some images such as scope overlays that are toggled inside the character blueprint, but they are defaulted to hidden until the visibility is triggered by a literal bool in a binding. The “visibility” of the hud is toggled off when the character dies and is initiated again on begin play when a new pawn is spawned.

This works appropriately 100% of the time as I toggle visibility for the hud widget and have a “killed by” widget that displays and the camera follows the instigator for a brief few seconds and it always works. At which point it is removed from parent and the widgets are gone. Always… The problem occurs here intermittently once the pawn is destroyed and a new one is being spawned by the server at which point the hand off to the controller to the new pawn has this issue where everything on that widget shows up on screen at once. But only every now and then when there is a hiccup in the network it seems… I’m pretty sure I can solve this by actually removing the widget from parent, but haven’t got a chance to tinker with it yet.

The real crazy part happens inside the transition level. Inside this level is a stand alone game mode that houses exactly one function and that is the server travel function that is called inside the transition level’s blueprint after displaying a progress widget that works perfectly for about 30 seconds.

After 30 seconds the level blueprint calls a function in the game instance to remove all widgets and then a function to display a loading screen and then a brief delay before the server travel function is called in the transition game mode back to the lobby.

Right after the remove all widgets function fires it does indeed work, but the loading screen doesn’t immediately appear even though it is called immediately and its not locked up by the server travel function because I let it wait a few seconds before executing that function… The loading screen pops quickly up after showing all this ugliness.

At this brief period when the widgets are missing, I see all the scope overlays and a widget that shows what round is occurring amongst others that shouldn’t be there. Most of them are being called at some point somewhere. Just not here. There is no pawn class specified for this level, no hud class, and no other widgets being called here besides a progress widget and loading screen. It’s bare bones. I have verified on the server log that it is in this transition level, the transition game mode is active. The things that are carried over are the player controller, just for this transition level, the player state and game state. The player controller is suspect here…

I do “GetPlayerController” in the game instance when calling these widgets. Is this a memory leak perhaps? Is there anything you know of that I could check to clear this from the viewport even though its not there in the first place? I suspected that I had some faulty logic in the character blueprint, but in this level there is nothing and no explanation why I see a bunch of widgets that have already been removed… Sorry for the long post. Its like the last little thing I need to work out of this game and its just stumped me…

1 Like

If anyone comes across anything remotely close to this, I resolved this myself… I found a work around to this problem and have pin-pointed the culprit, but it is still unexpected behavior that I probably may never understand.

Strangely, the widgets being created inside the game instance being called from EventBeginPlay of the character blueprint were being replicated to all clients despite there NOT being a server event or any type of replicated function executing this logic whatsoever. Maybe because the server owned the pawn and this is a dedicated server… idk.

The widget being removed before respawn event was working as expected, but if a player had a new pawn spawn from the server, the EventBeginPlay event that created their widget on the game instance also recreated the widget also on any other destroyed actor at the time unless it was valid and the widgets were displaying everything weird and conflicting with any and all visibility bindings while possessing a new pawn.

The work around was to call the widget function on EventBeginPlay> cast to the Player State and finally to the game instance to get it to reliably show on a dozen clients correctly and individually. I was able to remove the individual widget from a custom event from the character directly to the game instance lol. Very awkward, but it works. The player controller wouldn’t handle this on this many clients some worked some didn’t. idk.

I don’t know why events are replicating when they are not even in replicated functions or variables. I have this issue on some PlaySound2D nodes inside the character blueprint that are not replicated either. Very strange, but I’ve heard this before.

1 Like