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

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

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? )

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’

removeviewport.png

The only nodes available to me for the viewport

viewport2.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.