I have been having issues with my UMG Widgets since moving to 4.10 which only seems to occur in Multiplayer.
If there is the slightest hiccup, packet loss or break in communication between server and client or if the client stalls for too long - all user widgets for the client stop ticking. For me, this has also caused them to stop displaying (which I don’t understand, since I’ve never told them to do that). The widgets are still around, and are not GC’d, but they don’t draw or tick. There have been no mentions in the 4.10 release notes of stricter ticking, but I have so far found several changes to networking code that aren’t documented in those notes, and am worried that this is one of them.
It’s relatively easy to trigger this, I have a widget the the HUD adds to the Clients window on BeginPlay(). That widget is always in play for the entire game and is never removed. Doing network heavy tasks like taking possession of a different pawn (in my case, hoping in or out of a vehicle), or even when the client first joins the match causes this behavior. The only common thing I can see here is that the Pawn changes when this happens, but why would that be an issue?
Child widgets still remain in the viewport, but unless the parent tells them too then they also aren’t ticked.
The only way to get around this right now, is to Force-Tick the widgets by calling an Update function on them in DrawHUD. This is not ideal since it completely overrides the point of the slate optimizations that have been put in recently, and means that all widgets tick regardless of whether they’re on screen or not or even visible or not. What’s worse is that widgets that ARE on-screen are then ticked twice, both by NativeTick() and the call from the HUD.
My game isn’t doing anything special nor at any point does it tell that widget to hide itself, so I can only guess this is due to an engine change, but it seems like quite a breaking change. I don’t have a project to hand that can easily demonstrate this without giving all my source code away, but I’m sure it’s easy to create one that will do the same thing.
Hi Rudy, I spoke to Nick Darnell yesterday and am going to try and create a bare bones project to replicate the issue. It does mean I have to setup some MP stuff so will take a few days.
The problem appears to be related to the widgets being redrawn / rebuilt when a client changes the pawn they are possessing. Nick seems to think that the widgets get a full tear down and rebuild when a player changes pawn. In MP that can take a little while for clients hence why the issue happens for them and not a server or single player.
In my case they never get drawn properly after that tear down I believe.
I understand that you are working on a reproducible test case, however we have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with the additional information when you are finished and we will offer further assistance.
I’ve attached source code of how I create the widgets, which is almost identical to ShooterGame, but I use a UMG widget instead of a Slate Widget. Whoever tests this will have to add in the code to swap possession to a different pawn, unfortunately creating a test case for this is like creating a new project on it’s own
This code only occurs when the game starts, the actual problem will show when somebody tries to switch pawn.link text
Thank you for taking the time to provide the information above. However, I will need a few more bits of information before I can begin testing this issue. Could you provide the header file? There also appears to be 2 functions which are inside different classes. Could you specify if either/both are declared as UFUNCTION() and if so, what is used inside the UFUNCTION macro?