Removing widget from viewport with a multicast event 4.5.1 UMG

So, I got a lobby made with UMG, players that host/join get this assigned to them through their player controller and keep a reference to it for later removal.

Launching with “stand-alone game” and multiple clients confirms this working.

Only host is able to start game which is where things start to go wrong. Even though Remove Lobby function is called and executed to All, it does not actually remove anything.

lobby widget never gets removed from screen, game loads and in-game HUD draws on top of lobby. I see print string in Remove Lobby event but unfortunately widget never goes away on any of windows (client or host).

Any thoughts on why Remove from Viewport does not clear widget from screen?

Would really appreciate any kind of insight into this.

You got it, they are simple branch checks for IsServer and IsDedicatedServer.

I’ve not done a test with dedicated server only, because logic behind all clients being ready is not yet worked out.

Since this is not pertaining to dedicated server only case that you mentioned, would you still like me to reproduce this in a test project for you?

Hi ,

I’ve tried to reproduce issue you describe with information you provided, but I’m not able to get it working. Are your custom macros IsServer and IsDedicated simple Branch checks, or is there more involved? Are you attempting to run a dedicated server game only, or either?

If you can, please reproduce this in a test project for me and send me a download link. There have been some issues with UMG and dedicated server setups and I’d like to see if this is a bug or if we can work around it. Thanks!

If you don’t mind. Is goal to get button to only appear on server? And then have server change map for all clients?

Sure thing , it’s not a problem, I hope this will help you track issue faster.

SampleProject

Here is a completely blank project with bare essentials that demonstrate what I’m trying to accomplish, here are repro steps:

  • Set PIE to 2 clients and choose stand alone game
  • Open console on each window and get them to Open Menu (I do this to demonstrate widget from Menu to Multiplayer getting cleared)
  • Click Host on one window and join on other window
  • From here, click button on server to travel them to game
  • You will notice widget does not get removed in transition from Multiplayer to Game on either of two windows.

server does traveling, maps are changing for clients and server, problem is only with UMG widget never going away when using Remove from Viewport in multicast function.

So, my goal, is to remove Multiplayer widget from both server and client moment server clicks that button. That way when they both load Game they only see HUD.

Hey ,

When I play with 2 or more clients in new editor windows and follow these directions, widget is removed when server launches game. Running Standalone Game with Use Single Process disabled and Editor Client Mode set to Play As Listen Server also works fine for me. Are there any other settings I need to adjust to reproduce issue in test project?

It also seems that if you click Join on Client before Server clicks Host, Start Game button appears in both windows and is not removed after clicking.

I made a video to demonstrate settings we are using and what you suggested. Hopefully it helps in repo. https://www…com/watch?v=wgqOv8aVYU4&feature=youtu.be

Any chance on an update for this?

Hi ,

I’m still looking into this. It seems that after I posted, I was no longer able to get widget to be removed either. I’m not certain what I was doing that made it work, but I have contacted a few of developers to see what might be causing issue. Thanks for your patience!

ahh I see. So, witchcraft.

Hey ,

I was able to narrow it down to Remove from Viewport and Remove from Parent nodes, which do not appear to function as expected when there are 2 or more clients playing. I have entered a bug report for our developers to look over (UE-5593), and I will let you know when I see an update. If I am able to find a workaround, I will post it here. Thanks for your report and for your patience!

Alright thanks for heads up. Quite a strange bug to stumble across.

Hi , It’s been a while since we looked at this and just tried it again in a 4.6.1 build. It still seems to be there.

Can we get an update on it. Should we expect it to be fixed in 4.7 when it is out of preview?

Hey ,

Sorry for delay in response, I had some following up to do with developers’ response.

I’m told that this isn’t a UMG issue, but an issue with how UI is called. You’re creating multiple copies of widgets (add a print statement to see how many times it executes). IsValid checks won’t be enough to stop this, because there are two copies of everything because there are two players. You need to be doing checks to see if controller is a local controller.

best thing to do would probably be to move this code into player controller instead of pawn. pawns can be created prior to controller begin assigned before Begin Play, and Possessed usually runs on Server only. Running this in controller is most reliable way to know if it’s a local user or not. It can then tell pawn to create a widget, if you need to do it that way, but you may as well do it in controller.

Hope that helps!