Widget Performance Issues

Hi there, I have noticed this bug in an earlier version of Unreal Engine 4 but I was making a chat system in Blueprint last night and basically it seems the more widgets you add into a scrollbox or any other kind of container the more the FPS of the game drops. I then because of this tried to implement a system which caps the number of children that the scrollbox could hold by deleting the oldest child once it reaches 250. The performance issue still however seems to occur and the FPS gradually decreases. To go about replicating this I would setup a scrollbox on a widget and put an event tick to add widgets into the scrollbox as children and then watch using the the “Stat FPS” command. Please fix this! I wanted to use this chat system in a game but if this bug continues I won’t be able to. Thanks :slight_smile:

Let me get this right. You’re adding new widgets on tick and calling the associated performance hit as a “bug”? You might want to do a bit of reading first…

Hey I think you’re doing it wrong. You definitely should not be adding widgets on Event Tick. The reason is, it’s an expensive operation, you’re instantiating a visual object and adding it to the render tree, at 60 frame per second (more or less).

Widgets should be added once and then either recycled (look up object pooling) or simply created all at once at the start and then toggled on/off (Visibility: Collapsed / Visible)

No, I think I might have explained it badly. I used event tick to confirm that it was a bug, No matter how you add the widgets they still cause a lag. It was setup so that when you press enter it creates a message. No matter how these messages were created eventually they caused the client to permanently drop in FPS (Not just with event tick) But say all clients in the server typed out 1000 messages and used enter to send them this would add lag to the client even with a system automatically deleting the oldest message when there is over 250 widgets.

As I explained to Nick Jackson, I didn’t mean that this bug was specific to an event tick. It’s physically when any widget is added to a container using any method it causes lag on the clients. However, I thought since I had a system to delete them this would cause the lag to not get any worse once the max amount of widgets using the system I set up (250) had been reached but after more thought I think that it might not be a bug of sorts but I think that the widgets might be getting stored in ram so when you add them even if you delete them they still contribute to the lag because they aren’t being removed from ram (Hence the continuous FPS drop), Although i’m sure i’m likely wrong about that. But thank you for that info on object pooling.