For some reason, my widget updates have quite a big delay (sometimes close to 1s), which is a lot in a multiplayer game.
I can’t really find out what causes this. Could someone point me to a solution? Here’s the setup and problem displayed visually:
- When I attack other player I make some calculations on the server, and then I update the player’s CurrentHealth on the server.
- The CurrentHealth variable has “OnRep” replication, which triggers “Call On Health Change” event dispatcher.
- This dispatcher is subscribed by the widget above the player’s head, which then shrinks the player’s health bar.
Now, the issue:
The time between points 2 and 3 is almost a second for some reason.
Timestamps:
Green print - Server after calculations, just before dispatcher;
Red print - Widget just after dispatcher (the first thing in the dispatcher’s bound function)
Print before the RepNotify:
RepNotify function (Has authority is probably not needed but it doesn’t make difference):
Binding to the On Health Change event happens when the widget is constructed (it’s ready at the time I’m attacking):
The bound event starts with the print, but it’s already delayed, why?