Floating Combat Text keeps an array of combat text widgets and reuses them by enabling and disabling them, and changing the Visibility.
Status Effect and Combat Text adds a combat text widget to the viewport each time it need to display new damage text, plays the animation, and sets a delay to then remove it from it’s parent.
THIS ANSWER says that even after removed them from their parent, they are not removed from memory, While THIS ONE says that the garbage collector will handle it.
So, what approach should I be taking for doing floating combat texts? will the garbage collector actually remove them from memory after I remove them from their parent?
I had a bug occurring in a multiplayer game I am working on where a widget would sometimes not disappear on a client player’s death even when removed from parent. Using the “Collect Garbage” blueprint node did indeed get rid of the lingering widget.
We had a long discussion about this on another thread and the answer is basically that “garbage collection” will not clear references to widgets using “remove from parent” automatically. Calling the “collect garbage” function will however remove them although I have noticed when I experimented with this months ago that it will cause a hitch (UE4 warns you of this even) if there are numerous widgets to remove at once. Point being, this is going to be a manual call to clear the widgets.