Download

Issues with completely deleting a widget

Problem Solved

I wasn’t giving the “Add” function the actual object to add to the array. Fixed that and now it works fine.

Hi, I have a widget with an animation that simply displays a number ( amount of damage ) for a second over the character’s head. When the animation is complete, the widget should be deleted and never seen again.

I can’t get my widgets to die.

I store them in an array when I create them called ‘DamageWidgets’

Here is the widget graph for the numbers
05d5551c2b2f6065a55d295e10200bdd3f0d81e2.png

This is a function I made to easily create a widget on the fly and add it to the ‘DamageWidgets’ array
createdamagewidget_func.png

This is an update function, it’s called on Event Tick. I know it’s very sloppy, but it’s looping through all the DamageWidgets and seeing if the animation is finished, then removes it from the array and calls ‘Remove From Parent’ on the widget. ( I can’t find anything about removing it from the viewport? Does Remove From Parent automatically do that? )
c6c29bd4896b953d36668f4b7f3d3d82b95d09b6.png

I hope you can help

There should be a “remove from viewport” node.

Have you tried casting the “Array Element” to widget or your specific widget? Maybe it’s not recognized as one…

When I go off of the ‘ArrayElement’ it already has it as a ‘DamageDisplay’ widget, which is what I want. I can’t cast it to anything else other than itself lol.

I can’t find a remove from viewport node, no matter where I try it from the only remove I can find is ‘Remove From Parent’

0f86a0e881125533ac1607a3f39a99641f68a18c.png

The only nodes available to me for the viewport
1ed691e09e48e9c36b39596590b267df91be047f.png

3f666752252ed1b19f501e72a09a4ef50accfee5.png

In 4.6+, “Remove from Viewport” was replaced with “Remove from Parent”. “Add to Viewport” still works though… fyi.

OnAnimationFinished event could help you.