Floating Text Health Damage

I modeled a solution to floating text for health damage using this Floating Combat Text | Unreal Engine 4 Tutorial - YouTube but I noticed there was an issue with the game slowing down after running for like 40 minutes. My frames start at about 110 fps and slow down to 25 fps. My investigation narrowed down the problem to the widget, because after I turned off the floating text the fps stayed above 100 fps over 1 hour.

Note: I call “Remove from Parent” after text fades out. Does calling remove from parent destroy it properly and get cleaned up correctly for widgets?

Does anyone have any ideas on what might be going on?

Are there any other ways to implement floating text health damage?

Thanks,
Garett

Looks like you have a memory leak, don’t know why but by the looks of it it’s kinda tricky to destroy a widget well in your case its quite simple just reuse them. Make an array and add all the widget you create before you created a widget go to an array and check if index 0 widget already vanished if so reset it to visible and remove it from the array and add it again(it should add the widget at the top of the array, that way the most vanished will be always the first) repeat those steps and do if index 0 hasn’t vanished create another widget and add it to the top of the array.

Yes, I think you are right. I need to reuse the widgets and have a max number of them. I did read a few other answers related to this question and they did suggest object pooling.

I’m a little worried about performance in terms of removing and adding widgets in the array, but i’ll try more of an iteration through a circular array “approach” instead.

Creating a new widget cost a lot more than just adding it to an array, all professional game developers suggest reusing killed characters, its mostly used in 2D than 3D tough but it can be still used in 3D as well so don’t worry about it, its the correct(good coding) way to handle the problem. Good luck.

Are you sure we are talking about the same “worry”?

If I understood you correctly then yes, there no difference in the eyes of the CPU between a widget and other objects.